Dual EMA Spread Breakout Strategy
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…

Overview
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.
Strategy Logic
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.
Advantages
- Utilizes the trend following nature of EMAs for trading
- EMA spread breakout helps filter false signals during ranging periods
- Using different EMA combos reduces whipsaws in trend trading
- Can produce good returns in trending markets with proper settings
Risks
- EMAs lag in response to price changes, may miss turn points
- Less effective in low trending markets
- Prone to stop outs in choppy markets
- Improper EMA parameters can cause excessive false signals
Risks can be reduced via EMA tuning, spread threshold, and stop loss placement.
Enhancement Opportunities
- Optimize fast and slow EMA periods
- Test different EMA spread threshold values
- Improve stop loss strategies
- Add other filtering signals
- Parameter tuning to find optimal settings
Summary
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.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 0.95 | diffMinimum |
| v_input_2 | 13 | Small EMA |
| v_input_3 | 26 | Long EMA |
Source Pine Script
/*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)Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-25. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Dual-EMA-Spread-Breakout-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Adaptive Multi Period Trading Strategy Based on Wave Trend Momentum BreakoutPine Script · Breakout · 2h
- BB Breakout StrategyPine Script · Breakout · 1d
- BMSB Breakout Strategy BMSBPine Script · Breakout · 1h
- Bollinger Band T3 Moving Average StrategyPine Script · Breakout · 10m
- Bollinger Bands Dual track Breakthrough StrategyPine Script · Breakout · 30m
- Bollinger Breakout StrategyPine Script · Breakout · 30m