INVITE-ONLY SCRIPT

Multi-Timeframe Price Zones

56
📌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.

snapshot

■ 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).

snapshot

■ 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.

snapshot

■ 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.

snapshot
snapshot

■ 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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.