OPEN-SOURCE SCRIPT
Breakout Strategy with Dynamic SL Label

Description:
This script identifies breakout trading opportunities using adaptive support and resistance levels, adjusted dynamically based on market volatility. A trade signal is generated only when a breakout candle is followed by a confirming close in the same direction. The signal is displayed on the chart as a labeled marker that includes a suggested stop-loss level based on the highest high or lowest low of the past 10 bars, ensuring structure-aware risk management.
🧩 How it Works:
Adaptive S/R Zones: Based on volatility-normalized swing highs/lows using ATR. These zones automatically adjust to changing market conditions.
Confirmation Logic: Trade signals only appear after the second candle confirms the breakout, helping reduce false signals.
Single Signal Rule: Only one buy or sell label is printed per breakout level, avoiding repeated triggers.
Embedded Stop Loss in Label: SL value is calculated from the 10-bar high (for shorts) or low (for longs) and included in the signal label.
⚙️ User Inputs Explained:
Base Swing Strength: Controls the pivot sensitivity; higher values detect stronger reversal points.
Line Duration: Number of bars that horizontal S/R levels remain visible.
ATR Period: Length used to calculate volatility for adaptive S/R logic.
Volatility Sensitivity: Adjusts how responsive the S/R zone strength is to volatility. Higher = more responsive.
Stop-Loss Lookback (Bars): Defines the number of candles to reference when calculating SL from high/low structure.
Max Lines Stored: Controls chart clutter by limiting how many S/R zones are kept active.
🟩 Ideal for:
Breakout traders who value clean structure, confirmation, and built-in risk logic.
Scalpers and swing traders looking for adaptive, low-latency signals without repainting.
Chartists who want minimal indicators but maximum signal clarity.
This script identifies breakout trading opportunities using adaptive support and resistance levels, adjusted dynamically based on market volatility. A trade signal is generated only when a breakout candle is followed by a confirming close in the same direction. The signal is displayed on the chart as a labeled marker that includes a suggested stop-loss level based on the highest high or lowest low of the past 10 bars, ensuring structure-aware risk management.
🧩 How it Works:
Adaptive S/R Zones: Based on volatility-normalized swing highs/lows using ATR. These zones automatically adjust to changing market conditions.
Confirmation Logic: Trade signals only appear after the second candle confirms the breakout, helping reduce false signals.
Single Signal Rule: Only one buy or sell label is printed per breakout level, avoiding repeated triggers.
Embedded Stop Loss in Label: SL value is calculated from the 10-bar high (for shorts) or low (for longs) and included in the signal label.
⚙️ User Inputs Explained:
Base Swing Strength: Controls the pivot sensitivity; higher values detect stronger reversal points.
Line Duration: Number of bars that horizontal S/R levels remain visible.
ATR Period: Length used to calculate volatility for adaptive S/R logic.
Volatility Sensitivity: Adjusts how responsive the S/R zone strength is to volatility. Higher = more responsive.
Stop-Loss Lookback (Bars): Defines the number of candles to reference when calculating SL from high/low structure.
Max Lines Stored: Controls chart clutter by limiting how many S/R zones are kept active.
🟩 Ideal for:
Breakout traders who value clean structure, confirmation, and built-in risk logic.
Scalpers and swing traders looking for adaptive, low-latency signals without repainting.
Chartists who want minimal indicators but maximum signal clarity.
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.