Type/to search

MACD Trading Strategy with Adaptive ATR Stop Loss

Cryptocurrency
Created: 2023-09-20 15:23:00
Last modified: 3 years ago
1
Follow
1781
Followers

Overview

This strategy uses the MACD indicator to generate trading signals and adaptive ATR-based stop loss to control risks. It belongs to trend following strategies.

Strategy Logic

  1. MACD delta line crossover 0 produces buy and sell signals.

  2. Dynamic stop loss calculated based on recent N periods of ATR, which reflects volatility.

  3. Stop loss adjusts adaptively with volatility changes, widening when volatility surges.

  4. Update stop loss in real-time when in positions, to lock in profits and control risks.

  5. Exit positions when stop loss is triggered to manage risks.

Advantages

  1. MACD is sensitive in tracking trends.

  2. Adaptive stops fit different market environments, avoiding stops too tight or loose.

  3. Visual stop lines intuitively reflect risk status.

  4. Simple and clear strategy rules, easy to understand and implement.

  5. Controllable drawdowns and effective risk management.

Risks

  1. MACD may generate false signals causing unnecessary losses.

  2. Improper ATR parameters lead to stops too tight or loose.

  3. Risk of stops being triggered too frequently.

  4. Hard to stop out timely when trend reverses.

  5. Overfitting risk when optimizing parameters.

Enhancement

  1. Test MACD parameters for optimal combination.

  2. Try other stop methods like trailing stops.

  3. Optimize stops to balance frequency and risk control.

  4. Add trend filter to prevent reversal stops.

  5. Consider trading costs impact to avoid overtrading.

  6. Use slippage or enhanced stops to ensure stops triggered.

Conclusion

This strategy trades MACD signals with adaptive ATR dynamic stops. It features controllable risks and simplicity. But MACD signals may be false, and stops need continual optimization. Overall, with parameter tuning, stop optimization etc, it can become a robust trend following system.

Source
Pine
/*backtest
start: 2023-01-01 00:00:00
end: 2023-02-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("MACD BF 🚀", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.0)

/////////////// Time Frame ///////////////
Strategy parameters
Strategy parameters
Backtest Start Year
Backtest Start Month
Backtest Start Day
Backtest Stop Year
Backtest Stop Month
Backtest Stop Day
fastLength
slowlength
MACDLength
ATR Stop Period
ATR Stop Multiplier
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)