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.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.