OPEN-SOURCE SCRIPT
PTHLC Previous Timeframe High, Low, and Close

PTHLC — Previous Timeframe High, Low, and Close
PTHLC is a multi-timeframe market-structure indicator that displays the previous completed candle’s high, low, and close from a user-selected timeframe.
Unlike standard previous-day indicators, PTHLC can be applied to intraday or higher timeframes, making it useful for tracking levels from the previous 15-minute, 1-hour, 4-hour, daily, or other selected candle.
Major Features
Previous Timeframe Levels
The indicator plots:
PTH — Previous Timeframe High
PTL — Previous Timeframe Low
PTC — Previous Timeframe Close
The levels are based on the previous fully completed candle to provide stable, non-repainting reference points.
Automatic Timeframe Adjustment
When the selected reference timeframe is lower than the chart timeframe, the indicator automatically uses the chart timeframe instead of producing an error.
This allows the script to remain active as traders move between chart timeframes.
Confirmed Breach Detection
PTH and PTL are considered breached only after price closes beyond the level.
A close above PTH confirms a high breach.
A close below PTL confirms a low breach.
Breached levels are visually distinguished from active levels.
Bullish and Bearish Retest Logic
After a confirmed breach, PTHLC tracks the first return to the level.
A retest that closes above the level is classified as Retest Bullish.
A retest that closes below the level is classified as Retest Bearish.
The line, label, and table status update to reflect the retest direction.
Directional Previous Close
PTC provides immediate directional context:
Bullish when price is above PTC
Bearish when price is below PTC
Neutral when price is at PTC
PTC logic remains separate from the breach and retest logic used for PTH and PTL.
What Makes PTHLC Unique
Most previous-level indicators only plot static support and resistance lines.
PTHLC adds a complete level-state framework:
Active → Breached → Bullish or Bearish Retest
This helps traders quickly identify whether a previous timeframe level is untouched, broken, successfully held, or rejected after a retest.
PTHLC is designed for traders who use multi-timeframe structure, liquidity levels, breakout confirmation, support-and-resistance flips, and retest-based directional bias.
This indicator is intended as a market-analysis tool and does not provide guaranteed trade signals.
PTHLC is a multi-timeframe market-structure indicator that displays the previous completed candle’s high, low, and close from a user-selected timeframe.
Unlike standard previous-day indicators, PTHLC can be applied to intraday or higher timeframes, making it useful for tracking levels from the previous 15-minute, 1-hour, 4-hour, daily, or other selected candle.
Major Features
Previous Timeframe Levels
The indicator plots:
PTH — Previous Timeframe High
PTL — Previous Timeframe Low
PTC — Previous Timeframe Close
The levels are based on the previous fully completed candle to provide stable, non-repainting reference points.
Automatic Timeframe Adjustment
When the selected reference timeframe is lower than the chart timeframe, the indicator automatically uses the chart timeframe instead of producing an error.
This allows the script to remain active as traders move between chart timeframes.
Confirmed Breach Detection
PTH and PTL are considered breached only after price closes beyond the level.
A close above PTH confirms a high breach.
A close below PTL confirms a low breach.
Breached levels are visually distinguished from active levels.
Bullish and Bearish Retest Logic
After a confirmed breach, PTHLC tracks the first return to the level.
A retest that closes above the level is classified as Retest Bullish.
A retest that closes below the level is classified as Retest Bearish.
The line, label, and table status update to reflect the retest direction.
Directional Previous Close
PTC provides immediate directional context:
Bullish when price is above PTC
Bearish when price is below PTC
Neutral when price is at PTC
PTC logic remains separate from the breach and retest logic used for PTH and PTL.
What Makes PTHLC Unique
Most previous-level indicators only plot static support and resistance lines.
PTHLC adds a complete level-state framework:
Active → Breached → Bullish or Bearish Retest
This helps traders quickly identify whether a previous timeframe level is untouched, broken, successfully held, or rejected after a retest.
PTHLC is designed for traders who use multi-timeframe structure, liquidity levels, breakout confirmation, support-and-resistance flips, and retest-based directional bias.
This indicator is intended as a market-analysis tool and does not provide guaranteed trade signals.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.