OPEN-SOURCE SCRIPT

Swing Failures with ADX and EMA Confirmation

Setting Up the Indicator

  • Default Settings:
  • Override Swing Length: 5
  • Override Lookback Bars: 25
  • EMA 1 Period: 5
  • EMA 2 Period: 8
  • ADX Period: 14
  • ADX Threshold: 20


Recommended Settings:


  • For Low Timeframes (Scalping):
  • Timeframe: 1-minute to 15-minute charts.
  • Override Swing Length: 3 to 5
  • Override Lookback Bars: 10 to 20
  • EMA Periods: EMA 1 = 5, EMA 2 = 8 (default settings work well)
  • ADX Threshold: Lower threshold (e.g., 15) to capture shorter trends.


For High Timeframes (Swing Trading):
  • Timeframe: 1-hour to daily charts.
  • Override Swing Length: 5 to 10
  • Override Lookback Bars: 25 to 50
  • EMA Periods: EMA 1 = 20, EMA 2 = 50 (adjust for smoother signals)
  • ADX Threshold: Higher threshold (e.g., 25) to focus on stronger trends.




Swing Failure Patterns (SFP):

Bullish SFP:
Occurs when the price breaks below a previous swing low and then closes above it.
Suggests a potential upward reversal.

Bearish SFP:
Occurs when the price breaks above a previous swing high and then closes below it.
Indicates a potential downward reversal.


ADX and Directional Indicators (DI):
ADX Value: Measures the strength of the trend.

+DI and -DI Lines: Indicate the direction of the trend.
A crossover of +DI above -DI suggests bullish momentum.
A crossover of +DI below -DI suggests bearish momentum.

Exponential Moving Averages (EMAs):
EMA 1 (Default Period: 5): A faster-moving average.
EMA 2 (Default Period: 8): A slower-moving average.

EMA Crossover:
Bullish Crossover: EMA 1 crosses above EMA 2.
Bearish Crossover: EMA 1 crosses below EMA 2.



Interpreting the Signals
Bullish Entry Criteria:
Bullish SFP Identified:
The indicator plots an "SFP↑" label below the bar.
EMA Confirmation:
EMA 1 crosses above EMA 2.
ADX Confirmation:
ADX value is above the threshold.
+DI is above -DI.

Optional DI Crossover:
A "DI+↑" label appears, indicating +DI has crossed above -DI.
Bearish Entry Criteria:
Bearish SFP Identified:
The indicator plots an "SFP↓" label above the bar.
EMA Confirmation:
EMA 1 crosses below EMA 2.
ADX Confirmation:
ADX value is above the threshold.
-DI is above +DI.
Optional DI Crossover:
A "DI-↓" label appears, indicating +DI has crossed below -DI.

Trading Strategies

Scalping on Low Timeframes:
Objective: Capture small price movements within a short period.

Best Used When:

Market shows increased volatility.
During major market sessions (e.g., London or New York sessions).

Approach:

Use the lower override swing lengths and lookback bars.
Be quick to enter and exit positions based on the signals.
Set tight stop-losses just below/above recent swing points.

Risk Management:
Keep position sizes small due to the higher noise on low timeframes.
Use tighter profit targets.

Swing Trading on High Timeframes:
Objective: Benefit from larger price movements over several days or weeks.

Best Used When:
The market is trending strongly.
Economic news or events support potential trend continuation or reversal.

Approach:
Adjust EMA periods to 20 and 50 for smoother signals.
Increase the override swing length and lookback bars.
Allow trades more room to develop, using wider stop-losses.

Risk Management:
Use position sizing appropriate for longer-term trades.
Consider fundamental analysis alongside technical signals.

Optimizing Entries

Wait for Confirmation: Ensure all conditions are met before entering a trade.
Use Additional Indicators: Combine with support/resistance levels, Fibonacci retracements, or other indicators to strengthen the signal.
Monitor Market Conditions: Be cautious during low liquidity periods or major news releases.

Exiting Trades
Profit Targets:
Set based on recent highs/lows or key Fibonacci levels.
Use a risk-reward ratio of at least 1:1.5 or higher.
Trailing Stops:
Move your stop-loss in the direction of the trade as it becomes profitable.
Exit Signals:
Opposite SFP signals.
EMA crossovers in the opposite direction.
DI crossovers indicating momentum shift.

Additional Tips

Backtesting: Test the indicator on historical data to understand its performance.
Customize Parameters: Adjust settings based on the specific asset and timeframe.
Stay Disciplined: Stick to your trading plan and avoid emotional decisions.

Education: Continuously learn and stay updated with market trends.



Thank You for trying my indicator. I hope it brings your money
May the force be with you
Chart patternsDouble Exponential Moving Average (DEMA)Moving Averages

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer