OPEN-SOURCE SCRIPT
ULTIMATE SMC BREAKOUT AI

This is a Pine Script v5 trading indicator named "ULTIMATE SMC BREAKOUT AI". Summary of what it does and how it works:
Purpose
Detects breakout entries aligned with trend, plots suggested entry, stop-loss and two take-profit levels, highlights order blocks, an equilibrium line, and potential reversal zones. Provides alert conditions for buy/sell breakouts and reversal zones.
User inputs (configurable)
Fast/slow EMA lengths (default 50, 200)
ATR length and SL multiplier (default ATR14, SL = 1.2 * ATR)
TP1 and TP2 risk-reward multipliers (default 1.5 and 3.0)
Confirmation bars (default 2)
Toggles to show EMAs, Order Blocks, Equilibrium, Reversal Zones
Core logic
Trend filter: computes fast and slow EMAs. upTrend if EMA_fast > EMA_slow and price > EMA_fast; downTrend if EMA_fast < EMA_slow and price < EMA_fast. EMAs plotted if enabled.
Market structure breakout: defines a 20-bar swing high/low. A bullish breakout is price > prior swingHigh; bearish breakout is price < prior swingLow. A breakout must persist for confirmBars to be considered confirmed.
Entry signals: buySignal requires confirmed bullish breakout + upTrend; sellSignal requires confirmed bearish breakout + downTrend. buyFinal/sellFinal are first-bar triggers (only on the breakout bar).
ATR-based SL/TP: uses ATR to set SL distance (SL = entry ± ATR * slATR). Risk = distance entry↔SL. TP1 and TP2 set at entry ± (risk * tpRR).
Labels: when buyFinal/sellFinal occur the script places an on-chart label with ENTRY, TP1, TP2 prices.
Additional plotted/annotated elements
Order Blocks: highlights single-bar bullish order blocks (prior bar bearish, current close > prior high) and bearish order blocks (prior bar bullish, current close < prior low) as semi-transparent green/red boxes extending ~15 bars forward.
Equilibrium zone: plots mid-price of 50-bar highest high and lowest low (a yellow line).
Predictive Reversal Zones: marks potential reversal boxes when:
Liquidity sweep detected (current high > highest high of 10 bars prior OR current low < lowest low of 10 bars prior),
RSI conditions (RSI > 75 for bearish reversal, RSI < 25 for bullish reversal),
Candle direction confirming (bearish candle for bearish reversal, bullish for bullish reversal). These draw colored boxes and labels for "REVERSAL BUY/SELL ZONE".
Background color: faint green for upTrend, faint red for downTrend.
Alerts
Built-in alertconditions for BUY SIGNAL, SELL SIGNAL, Bullish Reversal, Bearish Reversal (triggerable in TradingView alerts).
Practical notes / behavior
Breakouts use a 20-bar swing lookback and require confirmationBars (default 2) — shorter/longer confirmation changes sensitivity.
SL/TP are purely mechanical from ATR—no partial fills, order execution logic, or trade management beyond TP1/TP2 drawn.
Order blocks detection is simplistic (single-bar pattern) and not a complex multi-bar block identification.
Reversal zones use a combination of liquidity sweep + extreme RSI + candle direction; they are predictive markers, not guarantees.
Designed for overlay on price; many plotted boxes/labels may clutter smaller timeframes or active instruments.
Purpose
Detects breakout entries aligned with trend, plots suggested entry, stop-loss and two take-profit levels, highlights order blocks, an equilibrium line, and potential reversal zones. Provides alert conditions for buy/sell breakouts and reversal zones.
User inputs (configurable)
Fast/slow EMA lengths (default 50, 200)
ATR length and SL multiplier (default ATR14, SL = 1.2 * ATR)
TP1 and TP2 risk-reward multipliers (default 1.5 and 3.0)
Confirmation bars (default 2)
Toggles to show EMAs, Order Blocks, Equilibrium, Reversal Zones
Core logic
Trend filter: computes fast and slow EMAs. upTrend if EMA_fast > EMA_slow and price > EMA_fast; downTrend if EMA_fast < EMA_slow and price < EMA_fast. EMAs plotted if enabled.
Market structure breakout: defines a 20-bar swing high/low. A bullish breakout is price > prior swingHigh; bearish breakout is price < prior swingLow. A breakout must persist for confirmBars to be considered confirmed.
Entry signals: buySignal requires confirmed bullish breakout + upTrend; sellSignal requires confirmed bearish breakout + downTrend. buyFinal/sellFinal are first-bar triggers (only on the breakout bar).
ATR-based SL/TP: uses ATR to set SL distance (SL = entry ± ATR * slATR). Risk = distance entry↔SL. TP1 and TP2 set at entry ± (risk * tpRR).
Labels: when buyFinal/sellFinal occur the script places an on-chart label with ENTRY, TP1, TP2 prices.
Additional plotted/annotated elements
Order Blocks: highlights single-bar bullish order blocks (prior bar bearish, current close > prior high) and bearish order blocks (prior bar bullish, current close < prior low) as semi-transparent green/red boxes extending ~15 bars forward.
Equilibrium zone: plots mid-price of 50-bar highest high and lowest low (a yellow line).
Predictive Reversal Zones: marks potential reversal boxes when:
Liquidity sweep detected (current high > highest high of 10 bars prior OR current low < lowest low of 10 bars prior),
RSI conditions (RSI > 75 for bearish reversal, RSI < 25 for bullish reversal),
Candle direction confirming (bearish candle for bearish reversal, bullish for bullish reversal). These draw colored boxes and labels for "REVERSAL BUY/SELL ZONE".
Background color: faint green for upTrend, faint red for downTrend.
Alerts
Built-in alertconditions for BUY SIGNAL, SELL SIGNAL, Bullish Reversal, Bearish Reversal (triggerable in TradingView alerts).
Practical notes / behavior
Breakouts use a 20-bar swing lookback and require confirmationBars (default 2) — shorter/longer confirmation changes sensitivity.
SL/TP are purely mechanical from ATR—no partial fills, order execution logic, or trade management beyond TP1/TP2 drawn.
Order blocks detection is simplistic (single-bar pattern) and not a complex multi-bar block identification.
Reversal zones use a combination of liquidity sweep + extreme RSI + candle direction; they are predictive markers, not guarantees.
Designed for overlay on price; many plotted boxes/labels may clutter smaller timeframes or active instruments.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.