Dual Moving Average Crossover Strategy
Overview
The Dual Moving Average Crossover strategy is a typical trend following strategy. It uses two EMA lines with different periods and goes long when the shorter period EMA crosses over the longer period EMA and goes short when the opposite crossing happens to capture trend reversals.
Principles
The core indicators of this strategy are two EMA lines, one is 30-period and the other is 60-period. The two EMA lines are calculated by custom functions in the code:
emaLen1 = emaFuncOne(close, lenMA1)
emaLen2 = emaFuncTwo(close, lenMA2)
The trading signals are generated from the crossing of the two EMA lines:
currentState = if emaLen2 > emaLen1
0
else
1
previousState = if emaLastLen2 > emaLastLen1
0
else
1
convergence = if currentState != previousState
1
else
0
When the shorter period EMA crosses over the longer period EMA, currentState is not equal to previousState, a crossover signal is triggered, go long.
When the shorter period EMA crosses below the longer period EMA, currentState is not equal to previousState, a crossover signal is triggered, go short.
Advantage Analysis
The advantages of this strategy are:
- The logic is simple and intuitive, easy to understand and implement
- Smoothes price fluctuations with EMA and filters out market noise
- Automatically follows trends, avoids missing trades
Risk Analysis
There are also some risks with this strategy:
- Crossover signals may lag and fail to capture reversals in a timely manner
- Whipsaw signals may occur frequently during ranging markets
- Poor parameter tuning may cause oversensitivity or delays
Optimization can be done by adjusting EMA periods or adding filters.
Optimization Directions
This strategy can be optimized from the following aspects:
- Test different EMA period combinations
- Add volume or volatility filters to reduce false signals
- Incorporate other indicators like MACD to confirm trends
- Optimize money management with stop loss and take profit
Conclusion
The Dual Moving Average Crossover strategy is a simple and practical trend following system overall. It is straight-forward, easy to implement and can automatically track trends. But some risks like lagging and false signals exist. With parameter tuning and adding filters, it can be further improved to become one of the fundamental algorithmic trading strategies.
- 1

