The Dual EMA Spread Breakout strategy is a trend following strategy. It uses two EMA lines with different periods and makes trades when there is a sufficiently large spread between the two EMAs to capture the trend direction. This strategy works well in markets with strong trending tendencies.
The strategy uses a fast EMA (shorter period EMA) and a slow EMA (longer period EMA) for trade signals. The specific logic is:
Calculate the fast EMA and slow EMA.
When the fast EMA crosses above the slow EMA, and the spread between the two EMAs exceeds a threshold, go long.
When the fast EMA crosses below the slow EMA, and the spread between the two EMAs exceeds a threshold, go short.
When the price breaks back below the fast EMA, close long positions.
When the price breaks back above the fast EMA, close short positions.
This way, it uses the smoothness of EMAs to identify trend direction, and the EMA spread breakout to determine precise entry timing. The larger the spread, the stronger the trend, and the bigger opportunity to trade.
Risks can be reduced via EMA tuning, spread threshold, and stop loss placement.
The Dual EMA Spread Breakout strategy is an effective yet simple trend following strategy. It can profit nicely in trending markets but needs proper parameters. With optimization and risk management, it can fully leverage its strengths. A worthwhile trend strategy to research and apply.
/*backtest start: 2023-09-24 00:00:00 end: 2023-10-24 00:00:00 period: 4h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy("2-EMA Strategy", overlay=true, initial_capital=100, currency="USD", default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075) diffMinimum = input(0.95, step=0.01) small_ema = input(13, title="Small EMA") long_ema = input(26, title="Long EMA") ema1 = ema(close, small_ema) ema2 = ema(close, long_ema) orderCondition = ema1 > ema2?((ema1/ema2)*100)-100 > diffMinimum:((ema2/ema1)*100)-100 > diffMinimum longCondition = close > ema1 and ema1 > ema2 if (longCondition and orderCondition) strategy.entry("Long", strategy.long) shortCondition = close < ema1 and ema1 < ema2 if (shortCondition and orderCondition) strategy.entry("Short", strategy.short) strategy.close("Short", when=close > ema1) strategy.close("Long", when=close < ema1) plot(ema(close, small_ema), title="EMA 1", color=green, transp=0, linewidth=2) plot(ema(close, long_ema), title="EMA 2", color=orange, transp=0, linewidth=2)