OPEN-SOURCE SCRIPT
LETHINH-Swing pa,smc

🟦 📌 Title (English)
Swing High / Swing Low – 3-Candle Fractal (5-Bar Pivot) | Auto Alerts
⸻
🟩 📌 Short Description
A clean and reliable swing high / swing low detector based on the classic 3-candle (5-bar) fractal pivot. Automatically marks SH/SL and triggers alerts when a swing is confirmed. No repainting after confirmation.
⸻
🟧 📌 Full Description (for TradingView Publishing)
🔶 Swing High / Swing Low – 3-Candle Fractal (5-Bar Pivot)
This indicator identifies Swing Highs (SH) and Swing Lows (SL) using the classic 3-candle fractal pattern, also known as the 5-bar pivot.
It marks swing points only after full confirmation, making it highly reliable and suitable for structure-based trading.
⸻
🔶 📍 How It Works
A swing is confirmed when the center candle is higher (or lower) than the two candles on each side:
Swing High (SH)
high[2] > high[3], high[1], high[0]
Swing Low (SL)
low[2] < low[3], low[1], low[0]
The confirmation occurs after 2 right candles close, so the indicator does not repaint once a swing is identified.
⸻
🔶 📍 Key Features
• Detects clean and accurate swings
• Uses pure price action — no indicators, no lag
• Marks swing high (SH) and swing low (SL) directly on the chart
• Non-repainting after confirmation
• Works on all timeframes and all markets
• Extremely lightweight and fast
• Includes alert conditions for both SH and SL
Perfect for traders using:
• Market Structure (BOS / CHoCH)
• Order Blocks (OB)
• Smart Money Concepts (SMC)
• Liquidity hunts
• Wyckoff
• Support/Resistance
• Price Action entries
⸻
🔶 📍 Why This Indicator Is Useful
Swing points are the foundation of market structure.
Accurately detecting them helps traders:
• Identify trend shifts
• Spot BOS / CHoCH correctly
• Find key zones (OB, liquidity levels, supply/demand)
• Time entries more precisely
• Avoid fake structure breaks
This indicator ensures swings are plotted only when fully confirmed, reducing noise and confusion.
⸻
🔶 📍 Alerts
You can create alerts for both conditions:
• Swing High Confirmed
• Swing Low Confirmed
Recommended settings:
• Once per bar close
• Open-ended alert
With alerts enabled, TradingView will automatically notify you every time a new swing forms.
⸻
🔶 📍 No Repainting
Once a swing is confirmed and plotted, it will not change or disappear.
This makes the indicator reliable for real-time alerts and backtesting.
⸻
🔶 📍 Pine Script (v5)
Paste your indicator code here if you want it visible.
Or leave the code hidden if you are publishing as protected.
⸻
🔶 📍 Final Notes
• This indicator focuses on confirmation, not prediction
• It is designed for clean structure reading
• All markets supported: Forex, Crypto, Stocks, Indexes, Commodities
• Suitable for scalping, intraday, swing, and even higher-timeframe trading
If you find this tool helpful, feel free to give it a like and add it to your favorites ❤️
Your support helps me share more tools with the community!
Swing High / Swing Low – 3-Candle Fractal (5-Bar Pivot) | Auto Alerts
⸻
🟩 📌 Short Description
A clean and reliable swing high / swing low detector based on the classic 3-candle (5-bar) fractal pivot. Automatically marks SH/SL and triggers alerts when a swing is confirmed. No repainting after confirmation.
⸻
🟧 📌 Full Description (for TradingView Publishing)
🔶 Swing High / Swing Low – 3-Candle Fractal (5-Bar Pivot)
This indicator identifies Swing Highs (SH) and Swing Lows (SL) using the classic 3-candle fractal pattern, also known as the 5-bar pivot.
It marks swing points only after full confirmation, making it highly reliable and suitable for structure-based trading.
⸻
🔶 📍 How It Works
A swing is confirmed when the center candle is higher (or lower) than the two candles on each side:
Swing High (SH)
high[2] > high[3], high[1], high[0]
Swing Low (SL)
low[2] < low[3], low[1], low[0]
The confirmation occurs after 2 right candles close, so the indicator does not repaint once a swing is identified.
⸻
🔶 📍 Key Features
• Detects clean and accurate swings
• Uses pure price action — no indicators, no lag
• Marks swing high (SH) and swing low (SL) directly on the chart
• Non-repainting after confirmation
• Works on all timeframes and all markets
• Extremely lightweight and fast
• Includes alert conditions for both SH and SL
Perfect for traders using:
• Market Structure (BOS / CHoCH)
• Order Blocks (OB)
• Smart Money Concepts (SMC)
• Liquidity hunts
• Wyckoff
• Support/Resistance
• Price Action entries
⸻
🔶 📍 Why This Indicator Is Useful
Swing points are the foundation of market structure.
Accurately detecting them helps traders:
• Identify trend shifts
• Spot BOS / CHoCH correctly
• Find key zones (OB, liquidity levels, supply/demand)
• Time entries more precisely
• Avoid fake structure breaks
This indicator ensures swings are plotted only when fully confirmed, reducing noise and confusion.
⸻
🔶 📍 Alerts
You can create alerts for both conditions:
• Swing High Confirmed
• Swing Low Confirmed
Recommended settings:
• Once per bar close
• Open-ended alert
With alerts enabled, TradingView will automatically notify you every time a new swing forms.
⸻
🔶 📍 No Repainting
Once a swing is confirmed and plotted, it will not change or disappear.
This makes the indicator reliable for real-time alerts and backtesting.
⸻
🔶 📍 Pine Script (v5)
Paste your indicator code here if you want it visible.
Or leave the code hidden if you are publishing as protected.
⸻
🔶 📍 Final Notes
• This indicator focuses on confirmation, not prediction
• It is designed for clean structure reading
• All markets supported: Forex, Crypto, Stocks, Indexes, Commodities
• Suitable for scalping, intraday, swing, and even higher-timeframe trading
If you find this tool helpful, feel free to give it a like and add it to your favorites ❤️
Your support helps me share more tools with the community!
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.