Type/to search

Dual Moving Average Crossover Strategy

Common strategy
Created: 2023-11-22 16:10:21
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This is a simple quantitative trading strategy based on moving average indicators. It uses the golden cross and death cross of fast and slow moving averages to determine entry and exit signals. When the fast MA crosses above the slow MA from below, a buy signal is generated. When the fast MA crosses below the slow MA from above, a sell signal is generated.

Strategy Logic

The strategy mainly leverages the trend tracking capability of moving averages. The fast MA has a smaller parameter and can quickly respond to price changes, while the slow MA has a larger parameter and represents the long-term trend. The fast MA crossing above the slow MA signals a reversal in short-term moves and the start of an uptrend. The fast MA crossing below the slow MA signals a reversal to a downtrend. By capturing these signals, we can trade along with the momentum.

Specifically, this strategy defines a 5-day (fast) and 34-day (slow) double moving average. It calculates these two MAs daily and checks if the fast MA crosses above or below the slow MA. If a golden cross happens, it goes long. If a death cross happens, it exits positions.

Advantage Analysis

This is a simple and easy to understand strategy, suitable for quant trading beginners. Compared to complex strategies, it is much easier to implement.

The dual MA strategy can filter out market noise effectively and capture the main trend. By tuning the MA days parameters, it can adapt to price swings across different time frames.

It also has a built-in stop loss mechanism. When prices start to reverse direction and the MAs death cross happens, it will exit positions timely to control risks.

Risk Analysis

The dual MA strategy has risks like failed stop losses or curve fitting failures. The main issues are:

  1. MAs have lagging effects and may generate signals only after the trend has already reversed. Profitable trades can turn into losses.

  2. In ranging markets, there can be many false signals, causing unnecessary trades, increased costs and slippage.

  3. It relies solely on technical indicators without combining fundamental analysis. It may perform poorly during events driving market moves.

  4. It does not consider position sizing and risk management. One black swan event can cause the strategy to blow up.

Optimization Directions

To better leverage its strengths and reduce risks, optimizations can be made in the following ways:

  1. Add trending indicators like MACD and volatility indicators like KDJ to set more rigorous entry rules and filter out false signals.

  2. Incorporate appropriate stop loss mechanisms, like exiting after prices drop a certain percentage post golden cross, or after prices fall a set range from new highs/lows.

  3. Optimize fast and slow MA days combinations to adapt to price swings across different time frames. Parameter optimization can find the best parameters.

  4. Reference broad market indices to determine overall market regime and avoid overtrading in ranging markets.

  5. Incorporate trading volume changes to verify the reliability of trend signals. For example, require strong volume when signals trigger.

Conclusion

The dual moving average crossover strategy is a very typical quantitative trading strategy. It has pros like simplicity, intuitiveness and ease of implementation. With continuous testing and parameter tuning, it can produce decent results. However, issues like lagging signal identification and false signals do exist. Additional filters and risk management mechanisms need to incorporated to make it a stable profit-generating strategy.

Source
Pine
/*backtest
start: 2022-11-15 00:00:00
end: 2023-11-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
// This strategy is a modification to the "Bill Williams, Awesome Oscillator
// (AO) Backtest" strategy (Copyright by HPotter v1.0 29/12/2016)
Strategy parameters
Strategy parameters
From Month
From Day
From Year
Length Slow
Length Fast
Include Short Trades
Trade reverse
length
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)