OPEN-SOURCE SCRIPT
Swing Breakout Strategy ver 1

Overview
A multi-confirmation swing strategy that seeks trend breakouts and adds three optional confluence modules: candlestick patterns, RSI/MACD regular divergences, and simple chart patterns (double top/bottom). Built for clarity, fast testing, and togglable debug markers.
Core Logic
Trend filter: SMA(50) vs SMA(200) + price vs SMA(21).
Breakout engine: Close breaks prior N-bar high/low (lookback configurable).
Momentum: Stochastic cross (optional view), MACD cross/zone, RSI regime (>50 or <50).
Volume: Above SMA(volume) filter.
Optional Confluence Modules
Candlestick analysis (enable/disable):
Bull/Bear Engulfing, Hammer, Shooting Star, Inside Bar (bull/bear flavors).
Divergence (enable/disable):
Regular divergences on RSI and MACD histogram using confirmed pivots (HH/LH or LL/HL).
Chart patterns (enable/disable):
Double Bottom (two similar lows + neckline break).
Double Top (two similar highs + neckline break).
Tolerance and pivot width are configurable.
Entries & Exits
Entry Long: Any of (Base Breakout + Trend + Momentum + Volume) OR enabled confluences (candles / divergence / pattern).
Entry Short: Symmetric logic for downside.
Risk management: Optional ATR-based stop loss and take profit (configurable length & multipliers).
Note: If you prefer confluences to be filters (AND), change the final buySignal/sellSignal lines accordingly.
Inputs (key)
SMA lengths (21/50/200), RSI length, Stochastic lengths & smoothing, MACD (12/26/9).
Breakout lookback, Volume SMA.
ATR exits (on/off, ATR length, SL/TP multipliers).
Toggles for Candlesticks, Divergences, Patterns, plus per-module debug markers.
Plots & Markers
Plots SMA 21/50/200.
Buy/Sell arrows on chart.
Optional debug markers for each condition (global-scope safe).
Divergence/pattern markers offset to the actual pivot/neckline bars.
Good Practices
Test on multiple timeframes and instruments; tune lookbacks and ATR multipliers.
Consider using the modules as filters in trending markets to reduce whipsaws.
Always forward-test and combine with position sizing.
Disclaimer
For educational purposes only. This is not financial advice. Trading involves risk.
Version & Credits
Pine Script® v6 — Strategy.
Developed by: Mohammed Bedaiwi.
A multi-confirmation swing strategy that seeks trend breakouts and adds three optional confluence modules: candlestick patterns, RSI/MACD regular divergences, and simple chart patterns (double top/bottom). Built for clarity, fast testing, and togglable debug markers.
Core Logic
Trend filter: SMA(50) vs SMA(200) + price vs SMA(21).
Breakout engine: Close breaks prior N-bar high/low (lookback configurable).
Momentum: Stochastic cross (optional view), MACD cross/zone, RSI regime (>50 or <50).
Volume: Above SMA(volume) filter.
Optional Confluence Modules
Candlestick analysis (enable/disable):
Bull/Bear Engulfing, Hammer, Shooting Star, Inside Bar (bull/bear flavors).
Divergence (enable/disable):
Regular divergences on RSI and MACD histogram using confirmed pivots (HH/LH or LL/HL).
Chart patterns (enable/disable):
Double Bottom (two similar lows + neckline break).
Double Top (two similar highs + neckline break).
Tolerance and pivot width are configurable.
Entries & Exits
Entry Long: Any of (Base Breakout + Trend + Momentum + Volume) OR enabled confluences (candles / divergence / pattern).
Entry Short: Symmetric logic for downside.
Risk management: Optional ATR-based stop loss and take profit (configurable length & multipliers).
Note: If you prefer confluences to be filters (AND), change the final buySignal/sellSignal lines accordingly.
Inputs (key)
SMA lengths (21/50/200), RSI length, Stochastic lengths & smoothing, MACD (12/26/9).
Breakout lookback, Volume SMA.
ATR exits (on/off, ATR length, SL/TP multipliers).
Toggles for Candlesticks, Divergences, Patterns, plus per-module debug markers.
Plots & Markers
Plots SMA 21/50/200.
Buy/Sell arrows on chart.
Optional debug markers for each condition (global-scope safe).
Divergence/pattern markers offset to the actual pivot/neckline bars.
Good Practices
Test on multiple timeframes and instruments; tune lookbacks and ATR multipliers.
Consider using the modules as filters in trending markets to reduce whipsaws.
Always forward-test and combine with position sizing.
Disclaimer
For educational purposes only. This is not financial advice. Trading involves risk.
Version & Credits
Pine Script® v6 — Strategy.
Developed by: Mohammed Bedaiwi.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.