OPEN-SOURCE SCRIPT
Zaktualizowano

Trend Structure & Untested Levels

555
Trend Structure & Tested Levels
Draws the swing trend as a zigzag, turns every swing into a support/resistance level, and tracks whether price has closed through it ("tested") or not ("untested").

Overview
A market-structure tool. It connects confirmed swing highs and lows into a clean zigzag trend line, then projects a horizontal level from each swing. Every level is classified by state — untested until a candle closes through it, after which the most recent break in each direction is flagged as Last Gained or Last Lost. The result is an at-a-glance map of the active structure and which levels are still in play.

What it does
Swing trend (zigzag). Connects confirmed pivot highs/lows into a trend line. A live, provisional leg always runs from the last confirmed pivot to the current price, so the structure reaches the current bar.
Automatic levels. Each swing high/low becomes a horizontal level — highs above price act as resistance, lows below price as support.
Tested vs untested. A level stays untested until a candle closes through it; a wick touch alone does not count.
Last Gained / Last Lost. The most recent resistance price closed above is tagged Last Gained (bullish break of structure); the most recent support price closed below is tagged Last Lost (bearish break).
Multi-timeframe
Levels — and the zigzag, in follow mode — can be drawn from the chart timeframe or any higher timeframe (e.g. D / W / M), labelled with a suffix such as (W). Higher-timeframe pivots are read without repainting forward-filled values and are anchored at the real pivot time, so an HTF level sits where it actually formed and runs horizontally across the whole chart.

Key settings
Pivot length — the master sensitivity control. Lower = a finer zigzag and more, smaller levels; higher = only the major structure.
Swing source — wicks (high/low) or candle bodies (open/close) to ignore wick spikes.
Zigzag follows levels timeframe — keep trend line and levels on one structure, or decouple the zigzag onto the chart timeframe.
Independent colours, line styles, widths, and a per-side cap on untested levels.
Notes
This is a visualisation of structure, not a signal or strategy — it says nothing about profitability; validate separately.
Repainting. Swings confirm pivot length bars after the fact, and the live leg moves with price until a new pivot confirms.
Not financial advice.
Informacje o Wersji
Bug Fixes
Informacje o Wersji
Better trend detection. Use Pivot length option to change sensitivity
Informacje o Wersji
english settings
Informacje o Wersji
Alerts on gained and lost levels

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.