OPEN-SOURCE SCRIPT
Edo Swing State

Edo Swing State — Labels Every Swing as HH, HL, LH or LL and Resolves Market Structure into a Single State



Market structure is the skeleton beneath almost every method of technical analysis: an uptrend is a run of higher highs and higher lows, a downtrend a run of lower highs and lower lows, and the moment that sequence breaks is the moment a trend starts to change. Edo Swing State makes that skeleton explicit. It detects each price swing, labels it with its structural role — higher high (HH), higher low (HL), lower high (LH) or lower low (LL) — and combines the last high and last low into one readable market state.
It draws a swing line that connects the confirmed pivots, marks each swing with a coloured HH/HL/LH/LL label, and reads the whole into Bullish, Bearish or Ranging in a compact panel — all validated on closed bars so the indicator does not repaint. It is a self-contained structure reader: the swings, their roles and the resulting state are all derived from the price series on the chart alone, with no dependency on any other tool.
THE HH / HL / LH / LL CLASSIFICATION
The indicator compares each new swing with the previous one of the same type. A swing high above the previous high is a Higher High (HH); below it, a Lower High (LH). A swing low above the previous low is a Higher Low (HL); below it, a Lower Low (LL). Each label is written at the pivot and does not move. Rising highs and rising lows are the signature of buying strength; falling highs and falling lows, the signature of weakness. High labels are drawn above the swing, low labels below it, colour-coded green for the bullish roles and red for the bearish ones.
SWING PROFILES
The sensitivity of the swings is set by a single Swing Profile input: Scalper (5 bars each side) for fast intraday swings on low timeframes, Swing (10 bars, the default) for the balanced 4H and daily read, and Long Term (21 bars) for the major swings on weekly and higher horizons. The larger the length, the more significant a turn has to be, and the fewer but more important the swings that are marked.
THE MARKET STATE
Above the individual labels, Edo Swing State resolves one overall state by combining the role of the last high with that of the last low. Bullish requires a last high of HH and a last low of HL — rising highs and lows. Bearish requires a last high of LH and a last low of LL — falling highs and lows. Any mixed combination is treated as Ranging. Requiring both sides to agree is deliberate: if price makes a higher high but then loses the previous low, the structure is no longer cleanly bullish, and the state turns to Ranging — precisely the transition zone where a trend starts to fail before the full turn is confirmed. The first LH after a run of HHs, or the first HL after a run of LLs, is the earliest crack in a trend, labelled the moment it is confirmed.
THE SWING LINE
The swing line connects the confirmed pivots in a continuous zigzag, tracing only the legs that run from one swing to the next and filtering out the intermediate noise. It reveals the real skeleton of the move — where price accelerates and where it loses momentum. The line and the labels can each be toggled independently, for a cleaner or a more informative chart.
INFORMATION PANEL
The panel condenses the read into a compact table under the indicator header: the overall market state (Bullish / Bearish / Ranging), the role of the most recent confirmed swing, and the role of the last high and the last low, in the same green/red colour code. The state row is the underlying read; the last-high and last-low rows explain why the state is what it is. The panel sits in any of the four chart corners (Top Right by default), comes in three sizes (Tiny / Small / Normal) and two themes (Dark / Light), and can be hidden entirely. To keep the calculation light, it is drawn only on the last bar.
NO REPAINTING
Swings are built on confirmed pivots and the state change is validated on closed bars, so a label never appears or disappears intrabar. There are no higher-timeframe functions: all logic runs on the current chart timeframe, which keeps the indicator lightweight and repaint-free. For a multi-timeframe read, apply it on several charts at once and look for the confluence of states.
CONFIGURATION
The inputs are grouped by block. Structure sets the swing profile and toggles the HH/HL/LH/LL labels and the swing line, listed in the settings as Show structure line (zigzag). Style exposes the bullish and bearish colours, the line colour and width, the label size and the Dark/Light theme. Panel controls panel visibility, position and size. The defaults are calibrated to work without adjustment on stocks, crypto, forex, indices and futures, on any timeframe — the input most users touch is the Swing Profile, to match the swings' sensitivity to their trading horizon.
ALERTS
Six predefined alerts cover the structure read. Four swing alerts — New Higher High, New Higher Low, New Lower High and New Lower Low — fire when each new pivot is confirmed with its role. Two structure alerts — Structure Bullish and Structure Bearish — fire only on the phase turn, when the overall state flips. All alerts fire on bar close, consistent with the indicator's anti-repaint validation.
HOW TO READ IT
Use the state as a context filter: look for longs while structure is Bullish and shorts while it is Bearish, and treat Ranging as caution — the zone where trends run out and false moves cluster. Use the change labels as an early warning: the first LH after a series of HHs, or the first HL after a series of LLs, flags a fading trend before the overall state fully turns. And read it in confluence: a Bullish state on the trading timeframe that sits inside a Bullish state on a higher one is a far more solid trend than an isolated read. Read on its own terms, the sequence of labels is the whole method: the roles say what the market is doing, and the state says whether it is doing it cleanly.
OPEN SOURCE
Edo Swing State is published as a free open source indicator. The full Pine Script is publicly accessible on TradingView for study, adaptation and integration into any workflow. Part of the Edolab Markets free tools ecosystem, all available on TradingView.
This indicator is a technical analysis tool for educational and informational purposes only. It does not generate automatic buy or sell signals and should not be considered financial advice. Trading financial markets involves significant risk of capital loss. Past performance does not guarantee future results. Always use proper risk management.
Market structure is the skeleton beneath almost every method of technical analysis: an uptrend is a run of higher highs and higher lows, a downtrend a run of lower highs and lower lows, and the moment that sequence breaks is the moment a trend starts to change. Edo Swing State makes that skeleton explicit. It detects each price swing, labels it with its structural role — higher high (HH), higher low (HL), lower high (LH) or lower low (LL) — and combines the last high and last low into one readable market state.
It draws a swing line that connects the confirmed pivots, marks each swing with a coloured HH/HL/LH/LL label, and reads the whole into Bullish, Bearish or Ranging in a compact panel — all validated on closed bars so the indicator does not repaint. It is a self-contained structure reader: the swings, their roles and the resulting state are all derived from the price series on the chart alone, with no dependency on any other tool.
THE HH / HL / LH / LL CLASSIFICATION
The indicator compares each new swing with the previous one of the same type. A swing high above the previous high is a Higher High (HH); below it, a Lower High (LH). A swing low above the previous low is a Higher Low (HL); below it, a Lower Low (LL). Each label is written at the pivot and does not move. Rising highs and rising lows are the signature of buying strength; falling highs and falling lows, the signature of weakness. High labels are drawn above the swing, low labels below it, colour-coded green for the bullish roles and red for the bearish ones.
SWING PROFILES
The sensitivity of the swings is set by a single Swing Profile input: Scalper (5 bars each side) for fast intraday swings on low timeframes, Swing (10 bars, the default) for the balanced 4H and daily read, and Long Term (21 bars) for the major swings on weekly and higher horizons. The larger the length, the more significant a turn has to be, and the fewer but more important the swings that are marked.
THE MARKET STATE
Above the individual labels, Edo Swing State resolves one overall state by combining the role of the last high with that of the last low. Bullish requires a last high of HH and a last low of HL — rising highs and lows. Bearish requires a last high of LH and a last low of LL — falling highs and lows. Any mixed combination is treated as Ranging. Requiring both sides to agree is deliberate: if price makes a higher high but then loses the previous low, the structure is no longer cleanly bullish, and the state turns to Ranging — precisely the transition zone where a trend starts to fail before the full turn is confirmed. The first LH after a run of HHs, or the first HL after a run of LLs, is the earliest crack in a trend, labelled the moment it is confirmed.
THE SWING LINE
The swing line connects the confirmed pivots in a continuous zigzag, tracing only the legs that run from one swing to the next and filtering out the intermediate noise. It reveals the real skeleton of the move — where price accelerates and where it loses momentum. The line and the labels can each be toggled independently, for a cleaner or a more informative chart.
INFORMATION PANEL
The panel condenses the read into a compact table under the indicator header: the overall market state (Bullish / Bearish / Ranging), the role of the most recent confirmed swing, and the role of the last high and the last low, in the same green/red colour code. The state row is the underlying read; the last-high and last-low rows explain why the state is what it is. The panel sits in any of the four chart corners (Top Right by default), comes in three sizes (Tiny / Small / Normal) and two themes (Dark / Light), and can be hidden entirely. To keep the calculation light, it is drawn only on the last bar.
NO REPAINTING
Swings are built on confirmed pivots and the state change is validated on closed bars, so a label never appears or disappears intrabar. There are no higher-timeframe functions: all logic runs on the current chart timeframe, which keeps the indicator lightweight and repaint-free. For a multi-timeframe read, apply it on several charts at once and look for the confluence of states.
CONFIGURATION
The inputs are grouped by block. Structure sets the swing profile and toggles the HH/HL/LH/LL labels and the swing line, listed in the settings as Show structure line (zigzag). Style exposes the bullish and bearish colours, the line colour and width, the label size and the Dark/Light theme. Panel controls panel visibility, position and size. The defaults are calibrated to work without adjustment on stocks, crypto, forex, indices and futures, on any timeframe — the input most users touch is the Swing Profile, to match the swings' sensitivity to their trading horizon.
ALERTS
Six predefined alerts cover the structure read. Four swing alerts — New Higher High, New Higher Low, New Lower High and New Lower Low — fire when each new pivot is confirmed with its role. Two structure alerts — Structure Bullish and Structure Bearish — fire only on the phase turn, when the overall state flips. All alerts fire on bar close, consistent with the indicator's anti-repaint validation.
HOW TO READ IT
Use the state as a context filter: look for longs while structure is Bullish and shorts while it is Bearish, and treat Ranging as caution — the zone where trends run out and false moves cluster. Use the change labels as an early warning: the first LH after a series of HHs, or the first HL after a series of LLs, flags a fading trend before the overall state fully turns. And read it in confluence: a Bullish state on the trading timeframe that sits inside a Bullish state on a higher one is a far more solid trend than an isolated read. Read on its own terms, the sequence of labels is the whole method: the roles say what the market is doing, and the state says whether it is doing it cleanly.
OPEN SOURCE
Edo Swing State is published as a free open source indicator. The full Pine Script is publicly accessible on TradingView for study, adaptation and integration into any workflow. Part of the Edolab Markets free tools ecosystem, all available on TradingView.
This indicator is a technical analysis tool for educational and informational purposes only. It does not generate automatic buy or sell signals and should not be considered financial advice. Trading financial markets involves significant risk of capital loss. Past performance does not guarantee future results. Always use proper risk management.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
EdoLab Markets – Precision Trading Tools
Get Exclusive Indicators:
edolab.io
All content provided is for informational and educational purposes only. Past performance does not guarantee future results.
Get Exclusive Indicators:
edolab.io
All content provided is for informational and educational purposes only. Past performance does not guarantee future results.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
EdoLab Markets – Precision Trading Tools
Get Exclusive Indicators:
edolab.io
All content provided is for informational and educational purposes only. Past performance does not guarantee future results.
Get Exclusive Indicators:
edolab.io
All content provided is for informational and educational purposes only. Past performance does not guarantee future results.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.