OPEN-SOURCE SCRIPT
Golden Zone Structure [Kodexius]

Golden Zone Structure is a ZigZag based market structure and Fibonacci tool designed to make swing context easier to read directly on the price chart. It detects meaningful pivot highs and lows, labels the evolving structure (HH, HL, LH, LL, including equal highs and lows), and automatically projects a Fibonacci map across the most recent completed swing.
Instead of forcing you to manually anchor Fib tools after every new leg, the script rebuilds levels each time a fresh pivot is confirmed. This makes it well suited for traders who focus on swing continuation, pullback depth, and reaction zones where liquidity and orderflow often concentrate.
A key emphasis is the Golden Zone highlight. The indicator shades the zone that is most relevant to the current swing context so you can quickly spot where a retracement is approaching a higher probability reaction area, without cluttering the chart with too many permanent objects.
The tool is intentionally visual and configurable. You can choose pivot source (High/Low or Close), adjust swing sensitivity via ZigZag period, switch color themes, and decide how much detail you want on screen (levels, zigzag lines, labels).
Optional trading markers can be enabled for users who want a lightweight “zone interaction” prompt. These markers are not intended as a standalone trading system. They are meant to complement your own confirmation rules (structure alignment, volume, higher timeframe bias, or price action triggers).

🔹Features
🔸 ZigZag Swing Engine
- Uses a configurable ZigZag period to filter noise and confirm swing points only when the lookback logic validates the move.
Supports different pivot sources (High/Low or Close) so you can choose between cleaner structure or more reactive behavior depending on the instrument.
Optional ZigZag leg drawing to visualize swing flow without clutter.
🔸 Market Structure Labels (HH, HL, LH, LL + Equals)
- Automatically labels each confirmed pivot based on how it compares to the prior pivot of the same type.
High side classification: H, HH, LH, EH.
Low side classification: L, HL, LL, EL.
Equal highs and lows help reveal potential liquidity pools and “magnet” areas where price often reacts or breaks with intent.
🔸 Auto Fibonacci Map on the Active Swing
- Rebuilds Fibonacci levels every time a new pivot is confirmed, keeping the projection aligned with the most recent completed leg.
Core retracement levels: 0.236, 0.382, 0.500, 0.618, 0.786.
Extension levels: 1.272 and 1.618 for expansion targeting and continuation mapping.
Optional price labels on each level, formatted to tick size so levels remain readable across markets.
🔸 Golden Zone Highlighting (Context Aware)
- Highlights the most relevant retracement band with a soft fill so you can spot “zone approach” moments at a glance.
The zone selection adapts to swing context, focusing on a different retracement region depending on whether the last confirmed pivot is a peak or a trough.
Adjustable transparency keeps the chart clean while preserving the key reaction area.
🔸 Visual Customization + Themes
- Multiple color themes (Neon, Ocean, Sunset, Monochrome) so the tool fits different chart styles and backgrounds.
Independent toggles for Fib levels, Golden Zone shading, ZigZag lines, and price labels.
Line width controls for better scaling across timeframes.



🔸 Optional Trading Markers + Alerts
- Optional BUY and SELL labels based on zone interaction logic with candle confirmation filters.


ATR based placement offset scaled by sensitivity so labels stay visually separated during volatility.
Built in alert conditions for new pivot highs and new pivot lows so you can monitor structure changes without watching every bar.
▶ Practical Usage Tip
• Use structure labels to define bias (HH + HL for bullish structure, LH + LL for bearish structure).
• Use the Golden Zone as a location filter, then wait for your own trigger (break of minor structure, rejection candle, volume shift, etc.).
• Treat extensions as “map points” not guaranteed targets. They work best when structure supports continuation.
Instead of forcing you to manually anchor Fib tools after every new leg, the script rebuilds levels each time a fresh pivot is confirmed. This makes it well suited for traders who focus on swing continuation, pullback depth, and reaction zones where liquidity and orderflow often concentrate.
A key emphasis is the Golden Zone highlight. The indicator shades the zone that is most relevant to the current swing context so you can quickly spot where a retracement is approaching a higher probability reaction area, without cluttering the chart with too many permanent objects.
The tool is intentionally visual and configurable. You can choose pivot source (High/Low or Close), adjust swing sensitivity via ZigZag period, switch color themes, and decide how much detail you want on screen (levels, zigzag lines, labels).
Optional trading markers can be enabled for users who want a lightweight “zone interaction” prompt. These markers are not intended as a standalone trading system. They are meant to complement your own confirmation rules (structure alignment, volume, higher timeframe bias, or price action triggers).
🔹Features
🔸 ZigZag Swing Engine
- Uses a configurable ZigZag period to filter noise and confirm swing points only when the lookback logic validates the move.
Supports different pivot sources (High/Low or Close) so you can choose between cleaner structure or more reactive behavior depending on the instrument.
Optional ZigZag leg drawing to visualize swing flow without clutter.
🔸 Market Structure Labels (HH, HL, LH, LL + Equals)
- Automatically labels each confirmed pivot based on how it compares to the prior pivot of the same type.
High side classification: H, HH, LH, EH.
Low side classification: L, HL, LL, EL.
Equal highs and lows help reveal potential liquidity pools and “magnet” areas where price often reacts or breaks with intent.
🔸 Auto Fibonacci Map on the Active Swing
- Rebuilds Fibonacci levels every time a new pivot is confirmed, keeping the projection aligned with the most recent completed leg.
Core retracement levels: 0.236, 0.382, 0.500, 0.618, 0.786.
Extension levels: 1.272 and 1.618 for expansion targeting and continuation mapping.
Optional price labels on each level, formatted to tick size so levels remain readable across markets.
🔸 Golden Zone Highlighting (Context Aware)
- Highlights the most relevant retracement band with a soft fill so you can spot “zone approach” moments at a glance.
The zone selection adapts to swing context, focusing on a different retracement region depending on whether the last confirmed pivot is a peak or a trough.
Adjustable transparency keeps the chart clean while preserving the key reaction area.
🔸 Visual Customization + Themes
- Multiple color themes (Neon, Ocean, Sunset, Monochrome) so the tool fits different chart styles and backgrounds.
Independent toggles for Fib levels, Golden Zone shading, ZigZag lines, and price labels.
Line width controls for better scaling across timeframes.
🔸 Optional Trading Markers + Alerts
- Optional BUY and SELL labels based on zone interaction logic with candle confirmation filters.
ATR based placement offset scaled by sensitivity so labels stay visually separated during volatility.
Built in alert conditions for new pivot highs and new pivot lows so you can monitor structure changes without watching every bar.
▶ Practical Usage Tip
• Use structure labels to define bias (HH + HL for bullish structure, LH + LL for bearish structure).
• Use the Golden Zone as a location filter, then wait for your own trigger (break of minor structure, rejection candle, volume shift, etc.).
• Treat extensions as “map points” not guaranteed targets. They work best when structure supports continuation.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.