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.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.