OPEN-SOURCE SCRIPT

Swing Highs and Lows Detector

95
๐Ÿ” 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

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.