PROTECTED SOURCE SCRIPT
Swing Trading System v5 - Dynamic SL/Targets with Labels

The Swing Trading System v5 is a fully-automated swing-trend framework designed to identify high-confidence breakout entries, generate dynamic stop-loss and target levels, and visually label actionable trade zones on the chart.
It adapts to market conditions using structure breaks, EMA trend filters, candle confirmation, and volume expansion signals.
Core Features
1. Swing Breakout Engine (Structure-Based)
The system detects short-term swing highs/lows and evaluates whether price has broken out above resistance or broken down below support.
A directional bias is established using a structure-based confirmation variable and automatically updated trailing stop logic.
2. Trend Filter (EMA 20/50/200)
To avoid counter-trend trades, the engine uses:
EMA-200 for primary trend direction
EMA-20 and EMA-50 for near-term momentum
Signals align only when structure breaks AND the major trend confirm each other.
3. Candle Confirmation
Entry signals require classical reversal momentum patterns:
Bullish Engulfing for long trades
Bearish Engulfing for short trades
This filters out weak structure breaks and ensures institutional momentum.
4. Volume Confirmation
Volume must exceed a configurable SMA-based threshold.
This prevents false signals during low-liquidity or consolidation phases.
Signal Logic
Long Signal Triggers
A Buy signal is printed when:
Price crosses above the dynamic trailing stop (swing resistance)
Price is above EMA-200 (bull trend)
Candle forms a bullish engulfing confirmation
Volume > SMA(10) × Multiplier
Short Signal Triggers
A Sell signal occurs when:
Price crosses below the dynamic trailing stop (swing support)
Price is below EMA-200 (bear trend)
Candle forms a bearish engulfing confirmation
Volume expansion confirms downside momentum
Dynamic Stop-Loss & Profit Targets
When a signal triggers, the system automatically calculates:
Stop-Loss (SL):
Long trades: last swing low
Short trades: last swing high
Target 1 (TP1): 1.5R relative to swing distance
Target 2 (TP2): 3.0R for trend continuation moves
SL, TP1, and TP2 are displayed on-chart using extended line plots and right-side labels for clean visualization.
Labels for old signals are automatically deleted to keep the chart uncluttered.
Visual Components
The indicator provides:
BUY/SELL signal labels
Dynamic SL, TP1, TP2 lines with color coding
SL/TP labels positioned at the end of each new trade
Clean breakout detection based on structural pivots
All elements update automatically as new swings form.
Intended Use
This system is built for:
Swing Traders
Systematic Discretionary Traders
Trend Followers
Breakout/Momentum Traders
Works well on:
Stocks
Crypto
Forex
Indices
Commodities
Optimal timeframes: 1H, 4H, Daily, Weekly
Summary
The Swing Trading System v5 provides:
High-quality breakout entries
Trend-aligned signals
Volume-filtered confirmation
Automated risk-reward generation
Clean and dynamic chart labels
A complete, self-contained swing-trading solution for systematic execution and disciplined risk management.
It adapts to market conditions using structure breaks, EMA trend filters, candle confirmation, and volume expansion signals.
Core Features
1. Swing Breakout Engine (Structure-Based)
The system detects short-term swing highs/lows and evaluates whether price has broken out above resistance or broken down below support.
A directional bias is established using a structure-based confirmation variable and automatically updated trailing stop logic.
2. Trend Filter (EMA 20/50/200)
To avoid counter-trend trades, the engine uses:
EMA-200 for primary trend direction
EMA-20 and EMA-50 for near-term momentum
Signals align only when structure breaks AND the major trend confirm each other.
3. Candle Confirmation
Entry signals require classical reversal momentum patterns:
Bullish Engulfing for long trades
Bearish Engulfing for short trades
This filters out weak structure breaks and ensures institutional momentum.
4. Volume Confirmation
Volume must exceed a configurable SMA-based threshold.
This prevents false signals during low-liquidity or consolidation phases.
Signal Logic
Long Signal Triggers
A Buy signal is printed when:
Price crosses above the dynamic trailing stop (swing resistance)
Price is above EMA-200 (bull trend)
Candle forms a bullish engulfing confirmation
Volume > SMA(10) × Multiplier
Short Signal Triggers
A Sell signal occurs when:
Price crosses below the dynamic trailing stop (swing support)
Price is below EMA-200 (bear trend)
Candle forms a bearish engulfing confirmation
Volume expansion confirms downside momentum
Dynamic Stop-Loss & Profit Targets
When a signal triggers, the system automatically calculates:
Stop-Loss (SL):
Long trades: last swing low
Short trades: last swing high
Target 1 (TP1): 1.5R relative to swing distance
Target 2 (TP2): 3.0R for trend continuation moves
SL, TP1, and TP2 are displayed on-chart using extended line plots and right-side labels for clean visualization.
Labels for old signals are automatically deleted to keep the chart uncluttered.
Visual Components
The indicator provides:
BUY/SELL signal labels
Dynamic SL, TP1, TP2 lines with color coding
SL/TP labels positioned at the end of each new trade
Clean breakout detection based on structural pivots
All elements update automatically as new swings form.
Intended Use
This system is built for:
Swing Traders
Systematic Discretionary Traders
Trend Followers
Breakout/Momentum Traders
Works well on:
Stocks
Crypto
Forex
Indices
Commodities
Optimal timeframes: 1H, 4H, Daily, Weekly
Summary
The Swing Trading System v5 provides:
High-quality breakout entries
Trend-aligned signals
Volume-filtered confirmation
Automated risk-reward generation
Clean and dynamic chart labels
A complete, self-contained swing-trading solution for systematic execution and disciplined risk management.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.