OPEN-SOURCE SCRIPT
Higher Timeframe Previous Candle Levels

What it does
This indicator draws the Open, High, Low, and Close levels of the most recently completed candle from a user-selected higher timeframe directly onto your current chart as horizontal reference lines. Each level is labeled with its name and exact price and optionally printed on the price scale for at-a-glance reference.

The key word is *completed* — it always references the previous fully closed candle on the chosen timeframe, never the still-forming one. This eliminates repainting and ensures the levels you see are historically locked.
How it works
The script uses `request.security()` with `open[1]`, `high[1]`, `low[1]`, and `close[1]` on the selected higher timeframe, combined with `lookahead=barmerge.lookahead_off`. The `[1]` offset targets the candle that has already closed (not the one currently forming), and disabling lookahead prevents any future data from leaking into historical bars. This is a non-repainting, structurally safe approach to multi-timeframe data retrieval.
The four price levels are rendered as persistent line and label objects that update only on the last bar of the chart (`barstate.islast`), keeping the drawing lightweight. Each level (High, Low, Open, Close) can be independently toggled, colored, and labeled.
Underlying concept
Higher-timeframe OHLC levels from the most recent closed candle act as intraday support, resistance, and directional bias markers. This is rooted in the institutional concept that completed macro candles define the structural "playing field" for price action on lower timeframes:

- The High and Low of the previous higher-timeframe candle define the range that was accepted by the market. A break above the high or below the low signals range expansion — a potential momentum move. Price remaining inside signals consolidation or rotation.
- The Open represents where institutional positioning began for that macro period. Price trading above the open suggests bullish control since the session/period started; below it, bearish.
- The Close reflects where the market settled in it, is the consensus price at the end of that macro period. Comparing current price to the previous close gives a quick read on whether the market is continuing or reversing relative to the last macro decision.
Together, these four levels create a structural framework: they tell you where the boundaries are, who was in control, and where the market agreed to settle. Watching how price reacts at these levels on lower timeframes — whether it respects, rejects, or breaks through them — provides high-probability context for entries, exits, and bias direction.
How to use it
1. Set the "Macro Timeframe" to the higher timeframe you want to reference (e.g., 4H while trading on 15m or 5m charts; Daily while trading on 1H; Weekly while swing trading on 4H).
2. The indicator immediately draws the previous completed candle's OHLC as horizontal lines.
3. Use the High and Low as potential breakout/breakdown or rejection zones. If price approaches the previous 4H high and stalls, that's a potential short-term reversal. If it drives through with volume, that's range expansion.
4. Use the Open as a directional bias filter. If you're scalping the 5-minute chart and price is above the previous 4H open, favor long setups. Below it, favor shorts.
5. Use the Close as a gauge of continuation vs. reversal. If the market opens a new macro candle and immediately moves away from the previous close, that's a sign of fresh directional intent.
6. Toggle individual levels on/off depending on your strategy. Some traders only need the High/Low range; others want the full OHLC picture.
What makes it original
Unlike multi-timeframe indicators that draw entire candles, session boxes, or pivot systems, this script focuses exclusively on the single most recently completed higher-timeframe candle — the one that has the most immediate relevance to current price action. It gives that single candle full visual treatment with individually customizable lines (style, thickness, color), independently togglable OHLC levels, freely positionable labels (left or right side, adjustable offset), and optional price-scale display. The emphasis is on clean, distraction-free, single-candle structural context rather than cluttering the chart with historical multi-timeframe data.
It is fully non-repainting by design — the combination of `[1]` offset and `lookahead_off` ensures no future data influences the displayed levels.
Suitable markets and trading styles
This indicator works on any market — forex, crypto, equities, indices, commodities, futures — anywhere that higher-timeframe structure provides meaningful context for lower-timeframe execution.
It is particularly suited for:
- Intraday scalping (1m–5m charts referencing 1H or 4H completed candles) — using the macro OHLC as scalp entry/exit boundaries and directional filters.
- Intraday momentum/breakout trading** (5m–15m charts referencing 4H or Daily candles) — watching for High/Low breaks as range expansion triggers.
- Swing trading (1H–4H charts referencing Daily or Weekly candles) — using macro close-to-close behavior and high/low range context for position bias.
It is not designed for long-term investing or position trading where single-candle reference levels lose relevance over multi-week or multi-month holding periods.
Disclaimer
This indicator is a visualization tool for higher-timeframe structural context. It does not generate buy or sell signals and should not be used as a standalone trading system. Always use it in conjunction with your own analysis, risk management, and trading plan. Past price structure does not guarantee future price behavior. Trading involves significant risk of loss.
This indicator draws the Open, High, Low, and Close levels of the most recently completed candle from a user-selected higher timeframe directly onto your current chart as horizontal reference lines. Each level is labeled with its name and exact price and optionally printed on the price scale for at-a-glance reference.
The key word is *completed* — it always references the previous fully closed candle on the chosen timeframe, never the still-forming one. This eliminates repainting and ensures the levels you see are historically locked.
How it works
The script uses `request.security()` with `open[1]`, `high[1]`, `low[1]`, and `close[1]` on the selected higher timeframe, combined with `lookahead=barmerge.lookahead_off`. The `[1]` offset targets the candle that has already closed (not the one currently forming), and disabling lookahead prevents any future data from leaking into historical bars. This is a non-repainting, structurally safe approach to multi-timeframe data retrieval.
The four price levels are rendered as persistent line and label objects that update only on the last bar of the chart (`barstate.islast`), keeping the drawing lightweight. Each level (High, Low, Open, Close) can be independently toggled, colored, and labeled.
Underlying concept
Higher-timeframe OHLC levels from the most recent closed candle act as intraday support, resistance, and directional bias markers. This is rooted in the institutional concept that completed macro candles define the structural "playing field" for price action on lower timeframes:
- The High and Low of the previous higher-timeframe candle define the range that was accepted by the market. A break above the high or below the low signals range expansion — a potential momentum move. Price remaining inside signals consolidation or rotation.
- The Open represents where institutional positioning began for that macro period. Price trading above the open suggests bullish control since the session/period started; below it, bearish.
- The Close reflects where the market settled in it, is the consensus price at the end of that macro period. Comparing current price to the previous close gives a quick read on whether the market is continuing or reversing relative to the last macro decision.
Together, these four levels create a structural framework: they tell you where the boundaries are, who was in control, and where the market agreed to settle. Watching how price reacts at these levels on lower timeframes — whether it respects, rejects, or breaks through them — provides high-probability context for entries, exits, and bias direction.
How to use it
1. Set the "Macro Timeframe" to the higher timeframe you want to reference (e.g., 4H while trading on 15m or 5m charts; Daily while trading on 1H; Weekly while swing trading on 4H).
2. The indicator immediately draws the previous completed candle's OHLC as horizontal lines.
3. Use the High and Low as potential breakout/breakdown or rejection zones. If price approaches the previous 4H high and stalls, that's a potential short-term reversal. If it drives through with volume, that's range expansion.
4. Use the Open as a directional bias filter. If you're scalping the 5-minute chart and price is above the previous 4H open, favor long setups. Below it, favor shorts.
5. Use the Close as a gauge of continuation vs. reversal. If the market opens a new macro candle and immediately moves away from the previous close, that's a sign of fresh directional intent.
6. Toggle individual levels on/off depending on your strategy. Some traders only need the High/Low range; others want the full OHLC picture.
What makes it original
Unlike multi-timeframe indicators that draw entire candles, session boxes, or pivot systems, this script focuses exclusively on the single most recently completed higher-timeframe candle — the one that has the most immediate relevance to current price action. It gives that single candle full visual treatment with individually customizable lines (style, thickness, color), independently togglable OHLC levels, freely positionable labels (left or right side, adjustable offset), and optional price-scale display. The emphasis is on clean, distraction-free, single-candle structural context rather than cluttering the chart with historical multi-timeframe data.
It is fully non-repainting by design — the combination of `[1]` offset and `lookahead_off` ensures no future data influences the displayed levels.
Suitable markets and trading styles
This indicator works on any market — forex, crypto, equities, indices, commodities, futures — anywhere that higher-timeframe structure provides meaningful context for lower-timeframe execution.
It is particularly suited for:
- Intraday scalping (1m–5m charts referencing 1H or 4H completed candles) — using the macro OHLC as scalp entry/exit boundaries and directional filters.
- Intraday momentum/breakout trading** (5m–15m charts referencing 4H or Daily candles) — watching for High/Low breaks as range expansion triggers.
- Swing trading (1H–4H charts referencing Daily or Weekly candles) — using macro close-to-close behavior and high/low range context for position bias.
It is not designed for long-term investing or position trading where single-candle reference levels lose relevance over multi-week or multi-month holding periods.
Disclaimer
This indicator is a visualization tool for higher-timeframe structural context. It does not generate buy or sell signals and should not be used as a standalone trading system. Always use it in conjunction with your own analysis, risk management, and trading plan. Past price structure does not guarantee future price behavior. Trading involves significant risk of loss.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.