OPEN-SOURCE SCRIPT
Swing Highs and Lows Detector

๐ Swing Highs and Lows Detector
The Swing Highs and Lows Detector is a powerful tool for traders looking to identify meaningful structural shifts in price action, based on swing point logic and internal trend shifts.
๐ What It Does
This indicator automatically identifies and labels:
HH (Higher High) โ Price broke above the previous swing high
LH (Lower High) โ Price failed to break the previous high, signaling potential weakness
LL (Lower Low) โ Price broke below the previous swing low
HL (Higher Low) โ Price maintained a higher support level, indicating strength
The script distinguishes between bullish and bearish internal shifts and tracks the highest/lowest points between those shifts to determine the swing structure.
โ๏ธ How It Works
You can choose between two shift detection modes:
"Open": Compares closing price to the first open of the opposite streak
"High/Low": Uses the high of bearish or low of bullish candles
Once a shift is confirmed, the indicator scans the bars between shifts to find the most significant swing high or low
When a valid swing is detected, itโs labeled directly on the chart with color-coded markers
๐๏ธ Built-in Alerts
Set alerts for:
Higher High
Lower High
Lower Low
Higher Low
These alerts help you catch key structural shifts in real time โ great for breakout traders, structure-based analysts, and smart money concepts (SMC) strategies.
โ How to Use
Confirm Trend Strength or Reversals โ Use HH/HL to confirm an uptrend, LL/LH to confirm a downtrend
Combine with Liquidity Sweeps or Zones โ Ideal for SMC or Wyckoff-style setups
Entry/Exit Triggers โ Use swing breaks to time entries or exits near key structural points
The Swing Highs and Lows Detector is a powerful tool for traders looking to identify meaningful structural shifts in price action, based on swing point logic and internal trend shifts.
๐ What It Does
This indicator automatically identifies and labels:
HH (Higher High) โ Price broke above the previous swing high
LH (Lower High) โ Price failed to break the previous high, signaling potential weakness
LL (Lower Low) โ Price broke below the previous swing low
HL (Higher Low) โ Price maintained a higher support level, indicating strength
The script distinguishes between bullish and bearish internal shifts and tracks the highest/lowest points between those shifts to determine the swing structure.
โ๏ธ How It Works
You can choose between two shift detection modes:
"Open": Compares closing price to the first open of the opposite streak
"High/Low": Uses the high of bearish or low of bullish candles
Once a shift is confirmed, the indicator scans the bars between shifts to find the most significant swing high or low
When a valid swing is detected, itโs labeled directly on the chart with color-coded markers
๐๏ธ Built-in Alerts
Set alerts for:
Higher High
Lower High
Lower Low
Higher Low
These alerts help you catch key structural shifts in real time โ great for breakout traders, structure-based analysts, and smart money concepts (SMC) strategies.
โ How to Use
Confirm Trend Strength or Reversals โ Use HH/HL to confirm an uptrend, LL/LH to confirm a downtrend
Combine with Liquidity Sweeps or Zones โ Ideal for SMC or Wyckoff-style setups
Entry/Exit Triggers โ Use swing breaks to time entries or exits near key structural points
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.