Understanding market structure across multiple timeframes is essential for traders aiming to align their strategies with broader trends. Inspired by Rob Smith’s TheStrat methodology—emphasizing full timeframe continuity—this indicator provides a visual representation of higher timeframe price action directly on lower timeframe charts. By integrating MultiTimeframe Candles, traders can maintain contextual awareness, avoid counter-trend trades, and improve decision-making precision.
This guide walks through the logic, implementation, and practical application of the indicator, optimized for clarity, usability, and alignment with advanced trading principles.
How the MultiTimeframe Candle Indicator Works
The core function of this Pine Script indicator is to project the open, high, low, and close (OHLC) values of a selected higher timeframe onto your current chart—regardless of its native timeframe. This allows you to see how current price movement fits within the context of larger cycles like daily, weekly, or monthly trends.
Step 1: User Input Configuration
Customization begins with two simple inputs:
_timeframe_opt = input.timeframe("60", "Select Timeframe", options=["1", "3", "5", "15", "30", "60", "240", "D", "W", "M", "3M", "12M"])
_show_hl = input.bool(false, "Show Hi/Lo")timeframe_opt: Lets users choose any standard timeframe from 1-minute up to 12-month intervals.show_hl: A toggle that enables or disables visual markers for high and low points within the custom candle.
👉 Discover how professional traders use multi-timeframe analysis to refine entries and exits.
This flexibility ensures that whether you're scalping on a 5-minute chart or swing trading on an hourly basis, you can simultaneously monitor key levels from daily or weekly structures.
Detecting New Candles in the Selected Timeframe
Accurate plotting hinges on identifying when a new candle begins in the chosen timeframe:
_is_new_candle = (time(timeframe_opt) != time(timeframe_opt)[1])This line compares timestamps between the current and previous bars. If they differ, it signals the start of a new candle in the selected timeframe—triggering updates to OHLC values.
This detection mechanism ensures synchronization with real market cycles, avoiding misaligned data that could distort analysis.
Initializing Key Variables
To track price movement within each custom candle, the script declares persistent variables:
var float open_offset = na
var float high_offset = na
var float low_offset = na
var float close_offset = na
var line ln = naThese var-declared variables retain their values across bars until explicitly updated, allowing continuous tracking of the custom candle’s evolution.
Calculating OHLC Offsets Relative to Open
One of the most innovative aspects of this script is how it calculates price levels relative to the opening price of the custom timeframe candle.
if is_new_candle
open_offset := open
high_offset := high - open_offset
low_offset := low - open_offset
close_offset := close - open_offset
else
high_offset := math.max(high - open_offset, high_offset[1])
low_offset := math.min(low - open_offset, low_offset[1])
close_offset := close - open_offsetOn the first bar of a new timeframe candle:
- The
open_offsetanchors the starting price. - High, low, and close are measured as deviations from this open.
In subsequent bars:
- The script dynamically updates the highest high and lowest low relative to the original open.
- The close offset updates with each new tick.
This relative calculation enables accurate candle formation even when rendered on lower timeframes.
Plotting the Custom Candle
Using Pine Script’s plotcandle() function, the indicator draws a live-updating candle:
plotcandle(
open_offset - open_offset, high_offset, low_offset, close_offset,
title="Custom Timeframe Candle",
color=(close_offset >= 0 ? color.green : color.red),
bordercolor=color.black, wickcolor=color.black
)Note: open_offset - open_offset equals zero—this centers the candle at the baseline while plotting deviations above and below.
- Color Logic: Green if close ≥ open (bullish), red otherwise (bearish).
- Styling: Black borders and wicks enhance visibility against various chart backgrounds.
This visual feedback helps traders instantly assess momentum and trend direction within the higher timeframe—without switching charts.
Displaying High and Low Markers
For enhanced precision, users can enable circular markers at peak and trough levels:
plot(show_hl ? high_offset : na, color=color.black, style=plot.style_circles)
plot(show_hl ? low_offset : na, color=color.black, style=plot.style_circles)These small but impactful details make it easier to spot resistance and support zones forming within the active higher-timeframe candle.
Visual Cues for Intraday Timeframes
To highlight transitions between candles on intraday charts:
if is_new_candle and timeframe.isintraday
ln := line.new(bar_index, 2.22, bar_index, -2.22,
xloc=xloc.bar_index, color=color.new(color.black, 45),
style=line.style_dashed, width=1, extend=extend.both)A semi-transparent dashed vertical line spans the chart at the start of each new intraday candle. This subtle marker improves readability, especially during fast-moving sessions.
Real-Time Timeframe Labeling
Clarity is further enhanced by a dynamic label in the top-right corner:
var table tf_table = table.new(position.top_right, columns=1, rows=1)
if is_new_candle
table.cell(tf_table, 0, 0, "Timeframe: " + timeframe_opt)This table displays the currently selected timeframe and refreshes only when a new candle forms—minimizing screen clutter while ensuring accuracy.
Practical Application: How to Use This Indicator
The true power of this tool emerges in multi-layered analysis.
Step-by-Step Setup
- Apply the indicator to your chart.
- Duplicate it for each higher timeframe you want to monitor (e.g., hourly, daily, weekly).
In each instance’s settings:
- Select the desired timeframe (e.g., “D” for daily).
- Toggle on/off high/low markers based on preference.
- Observe how price interacts with ongoing higher-timeframe candles.
For example:
- On a 15-minute BTC/USD chart, overlay daily and weekly candles.
- Watch how pullbacks align with weekly support zones.
- Avoid shorting during a rising daily candle unless clear reversal signs appear.
This method enforces discipline by anchoring short-term trades to long-term structure.
Frequently Asked Questions (FAQ)
Q: Can I use this on any asset class?
Yes. The indicator works across forex, stocks, commodities, and cryptocurrencies since it relies solely on price and time data available in all markets.
Q: Does this repaint or lag?
No. It uses confirmed OHLC data from completed or live bars in the selected timeframe. Values update only when new price information becomes available.
Q: Why are offsets calculated relative to open?
Relative calculation allows correct scaling regardless of chart timeframe. It ensures that a +$100 move appears consistent whether viewed on a 1-minute or daily chart.
Q: How many instances should I run at once?
Typically 2–4: one for immediate higher timeframe (e.g., H1 on M15), plus daily and weekly for trend context. Too many may clutter the chart.
Q: Is this compatible with TradingView’s alerts?
Yes. You can set alerts based on conditions involving offset values or candle colors—ideal for automated monitoring.
Q: What makes this better than built-in higher-timeframe overlays?
Unlike static overlays, this indicator renders dynamic candles that evolve in real time with live OHLC tracking—giving deeper insight into unfolding price behavior.
Core Keywords for SEO Optimization
- MultiTimeframe Candles
- Full Timeframe Continuity
- Higher Timeframe Analysis
- TradingView Pine Script
- Price Action Context
- OHLC Visualization
- Market Structure Indicator
- Trend Continuity Strategy
These keywords have been naturally integrated throughout headings and body text to boost search visibility without compromising readability.
Final Thoughts
The MultiTimeframe Candles indicator bridges a critical gap in technical analysis: real-time awareness of higher-timeframe dynamics. By visualizing daily or weekly price movement directly on lower charts, traders gain clarity, reduce emotional bias, and stay aligned with dominant trends.
Whether you're refining a scalping strategy or managing long-term positions, this tool offers actionable insights grounded in Rob Smith’s principle of full timeframe continuity.