Dual Moving Average Range Breakout Strategy
This strategy identifies trend breakouts by calculating moving averages over different timeframes. It allows low-risk trend following.

Overview
This strategy identifies trend breakouts by calculating moving averages over different timeframes. It allows low-risk trend following.
Strategy Logic
Go long when the 10-day EMA crosses above the 200-day EMA and the 20-day EMA crosses above the 50-day EMA. Go short when the 10-day EMA crosses below the 200-day EMA and the 20-day EMA crosses below the 50-day EMA. The dual moving average design filters false breakouts effectively.
The strategy first calculates four exponential moving averages (EMAs) over the 10-day, 20-day, 50-day and 200-day periods. The 10-day EMA represents short-term trend, 20-day intermediate, 50-day medium-term and 200-day long-term trend. When the shorter EMA crosses the longer EMA, it signals a potential trend reversal. However, using just one EMA crossover produces false signals easily.
To improve reliability, the strategy applies two layers of filtering: the 10/200 EMA cross gauges long/short-term trend shifts while the 20/50 EMA cross gauges medium/intermediate-term shifts. Trades are triggered only when both EMA pairs align in the same direction.
The dual EMA filtering significantly reduces false signals, generating more reliable trade entries.
Advantages
- Dual EMA filtering lowers false signals substantially
- Multiple timeframes offer robustness
- Simple parameterization facilitates usage
Risks
- Strong trend-following but misses reversals
- Potentially large stops when trends shift
- Insufficient history disadvantages new/exotic assets
Improvements include relaxing breakout thresholds, adding volume confirmation and optimizing parameters.
Enhancement Opportunities
- Add volume confirmation. Volume verifies if breakout is real or on low activity.
- Incorporate additional indicators like MACD, KDJ for greater stability.
- Optimize parameters like 10/20-day EMA durations for changing markets.
In summary, the dual moving average core supplemented with optimization, volume and more indicators can build a steady trend tracking system.
Conclusion
A simple but practical trend following strategy. The dual EMA core filters false breakouts reliably for quality signals. Easy parameterization also facilitates adoption. Further improvements in risk management and optimization can boost performance. Overall an accessible introductory quant strategy underpinned by simplicity.
Source Pine Script
/*backtest
start: 2023-12-12 00:00:00
end: 2023-12-13 02:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Advancing Our Basic Strategy", overlay=true)
ema10 = ema(close, 10)
ema20 = ema(close, 20)
ema50 = ema(close, 50)
ema200 = ema(close, 200)
long = ema10 > ema200 and ema20 > ema50
short = ema10 < ema200 and ema20 < ema50
longcondition = long and long[10] and not long[11]
shortcondition = short and short[10] and not short[11]
closelong = ema10 < ema200 or ema20 < ema50 and not long[11]
closeshort = ema10 > ema200 or ema20 > ema50 and not short[11]
plot(ema10, title="10", color=green, linewidth=2)
plot(ema20, title="20", color=red, linewidth=3)
plot(ema50, title="50", color=purple, linewidth=2)
plot(ema200, title="200", color=blue, linewidth=3)
testPeriodStart = timestamp(2018,8,1,0,0)
testPeriodStop = timestamp(2038,8,30,0,0)
if time >= testPeriodStart and time <= testPeriodStop
strategy.entry("Long", strategy.long, 1, when=longcondition)
strategy.entry("Short", strategy.short, 1, when=shortcondition)
strategy.close("Long", when = closelong)
strategy.close("Short", when = closeshort)Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-20. 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-Moving-Average-Range-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
- Multi Technical Indicator Dynamic Wave Trading StrategyPine Script · Breakout · 1h
- EMA ADX VOL CRYPTO KILLERPine Script · Breakout · 1d
- Momentum Breakthrough Moving Average Trading StrategyPine Script · Breakout · 3m
- Dual directional Trading Strategy Based on Quantitative Indicators Bullish and Bearish SignalsPine Script · Breakout · 1d
- Dual Moving Average Breakout Strategy 428692Pine Script · Breakout · 1h
- Multi Indicator Dynamic Trading Strategy with Volume Confirmation SystemPine Script · Breakout · 1h