The Dual Moving Average Golden Cross Quantitative Strategy is a technical indicator-based quantitative trading strategy. It determines market trends by calculating two moving averages of different periods and enables low-risk trading. When the shorter-period moving average crosses above the longer-period moving average, a golden cross signal is generated for going long. When the shorter moving average crosses below the longer one, a death cross signal is generated for going short. This strategy also incorporates price channel indicators to avoid false breaks.
The Dual Moving Average Golden Cross Quantitative Strategy is based on moving average theory. Moving averages can effectively filter market noise and indicate long-term trend directions. When the shorter-period moving average crosses above the longer-period moving average, it indicates an upward reversal of the market and is a buy signal. When the shorter moving average crosses below the longer one, it indicates a downward reversal and is a sell signal. This strategy sets two groups of moving averages - the first is the 2-day and 3-day moving averages, and the second is the 420-day moving average. A buy signal is generated when the 2-day crosses above the 3-day moving average, and a sell signal is generated when it crosses below. The 420-day moving average is used to determine the long-term trend to avoid trading short-term pullbacks.
The key logic of the strategy code is:
The specific principles are:
It catches trend reversal opportunities after short-term adjustments by determining turning points with dual moving average crossings and sets parameter filters to avoid mistaken trades. This strategy can effectively capture trend reversal opportunities after short-term adjustments with a relatively high profit factor.
The Dual Moving Average Golden Cross Quantitative Strategy has the following advantages:
The Dual Moving Average Golden Cross Quantitative Strategy also has the following risks:
The following methods can be used to reduce risks:
The Dual Moving Average Golden Cross Quantitative Strategy can also be optimized in the following aspects:
Parameter optimization: Adjust moving average and channel indicator parameters to select the optimal parameter combination. Genetic algorithms can assist optimization.
Timing selection: Choose the most suitable moving average parameters based on different product characteristics. For example, set shorter-period moving averages for interest-related products.
Stop loss strategy optimization: Set dynamic stops, trailing stops etc. to avoid pullback stops.
Directional trading optimization: Incorporate trend indicators and adopt trend-following operations to prevent countertrend trading.
Machine learning combination: Use LSTM, RNN and other deep learning models to assist in judging signal quality and determining entry timing.
The Dual Moving Average Golden Cross Quantitative Strategy determines short-term price trends through the simple principle of moving average crossovers. Setting channel indicators effectively filters false signals. The strategy has straightforward logic and is easy to implement. Flexible parameter adjustments are possible with relatively good performance validated in live trading. It is a recommended quantitative strategy that can be upgraded through parameter optimization, stop loss optimization, machine learning and more to achieve even better performance. The strategy is suitable for algorithmic trading across products like cryptocurrencies and stocks.
/*backtest start: 2023-12-24 00:00:00 end: 2023-12-25 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 // Indicator420 by SeaSide420 strategy("Indicator420 strategy", overlay=true) q=input(title="HullMA",defval=420) z=input(title="HullMA cross",defval=3) a=input(title="VWMA",defval=14) rvwma=vwma(close,round(a)) rvwma2=vwma(close,round(a*2)) rvwma3=vwma(close,round(a*3)) n2ma=2*wma(close,round(z/2)) nma=wma(close,z) diff=n2ma-nma sqn=round(sqrt(z)) n2ma1=2*wma(close[1],round(z/2)) nma1=wma(close[1],z) diff1=n2ma1-nma1 sqn1=round(sqrt(z)) n2ma2=2*wma(close[2],round(q/2)) nma2=wma(close[2],q) diff2=n2ma2-nma2 sqn2=round(sqrt(q)) n1=wma(diff,sqn) n2=wma(diff1,sqn) n3=wma(diff2,sqn) b=n1>n2?red:lime c=n1>n2?green:red d=n3>rvwma3?red:green e=rvwma2>rvwma3?green:red f=n1>n2?red:green //plot(rvwma3, color=e, linewidth=1) plot(cross(rvwma, rvwma2) ? rvwma : na, style = line,color=e, linewidth = 1) plot(cross(n1, n2) ? n1 : na, style = line,color=b, linewidth = 3) plot(cross(n1, n2) ? n1 : na, style = circles,color=c, linewidth = 4) closelong = n1<n2 if (closelong) strategy.close("Long") closeshort = n1>n2 if (closeshort) strategy.close("Short") longCondition = n1>n2 and strategy.opentrades<1 and n1<rvwma3 if (longCondition) strategy.entry("Long",strategy.long) shortCondition = n1<n2 and strategy.opentrades<1 and n1>rvwma3 if (shortCondition) strategy.entry("Short",strategy.short)