Multi-Timeframe Price Zones

This indicator plots dynamic multi-timeframe price zones—including previous highs/lows, pivot levels, and magnetic support/resistance regions—using auto-updating boxes on the chart, allowing traders to identify high-influence price areas across higher timeframes with clarity and precision.
■ Magnetic Zones 1 – Inputs
Timeframe: Selects the higher timeframe used for generating zones (e.g., D, W, M).
Show Last: Defines how many of the most recent timeframe zones to display.
PDHL: Toggles previous-day-high/low zones.
P: Toggles the pivot level (previous period midpoint).
SR1 / SR2: Enables two sets of magnetic support/resistance zones based on volatility expansion multipliers.
Sub Color: Sets the primary color used for box borders, backgrounds, and text.
■ General Zone Settings
Box Transparency: Adjusts opacity of filled price zones.
Border Style: Selects border style (solid, dashed, dotted).
Text Size: Controls label sizing for zone annotations.
Text Alignment: Positions labels inside boxes (left, center, right).
■ Data Retrieval Logic
The script pulls higher-timeframe timestamps and close times (time, time_close) using request.security, ensuring boxes start exactly at the beginning of the selected timeframe and extend to its closing bar.
A helper function retrieves any higher-timeframe price series (high, low, midpoint, and magnetic zone values).
■ Magnetic Zone Calculation
The script computes magnetic support/resistance levels using previous-bar volatility:
prev_hl_diff = previous high − previous low
Resistance = hl2 + (multiplier × prev_hl_diff)
Support = hl2 − (multiplier × prev_hl_diff)
Two multipliers are used:
0.236 → SR1
0.786 → SR2
These create responsive zones that expand/shrink with volatility.
■ Buffer Zone Expansion
Each level generates a “buffer zone”—a small band above/below the main value—to create visually meaningful zones rather than a single flat line:
top = level + range/8
bottom = level − range/8
Buffers are applied symmetrically around each SR level.
■ Zone Types Displayed
1. PDHL Zones (Previous High / Previous Low)
Retrieved directly from the selected higher timeframe’s last completed bar.
2. Pivot Zone (P)
Based on midpoint (hl2) of the previous period.
3. Magnetic Zones SR1 / SR2
Volatility-based resistance/support zones with buffer expansion.
■ Box Rendering System
The script uses a generalized draw_box() function that draws labeled rectangles using:
timeframe start/end timestamps
top/bottom price boundaries
custom background transparency
border style and width
optional price annotations
All box references are stored in arrays for proper management and future cleanup.
■ Auto-Updating Logic
Whenever the higher timeframe changes (timeframe.change()):
New boxes are created for SR1, SR2, pivot, and PDHL levels.
Boxes extend from the higher timeframe’s opening timestamp to its closing timestamp.
Price labels include the exact value and the timeframe abbreviation.
This ensures zones remain aligned with the boundaries of each higher-timeframe candle.
■ Purpose
This indicator is designed to:
Highlight multi-timeframe price zones such as PDHL, pivots, and magnetic SR ranges.
Provide contextual support/resistance from a higher timeframe while trading lower timeframes.
Visualize volatility-driven price zones that often act as reaction levels.
Draw clean, well-structured, auto-refreshing boxes with customizable styling.
It does not attempt to predict price or generate trade signals—its function is structural visualization.
■ Notes
Zones update only when the higher timeframe completes.
Buffer zones visually emphasize areas of interest rather than single price lines.
Transparency and styling allow integration into any chart layout.
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact c9indicator directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Disclaimer
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact c9indicator directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.