This strategy generates trading signals based on the golden cross and dead cross of moving averages with different cycles. It belongs to a typical trend-following strategy. Weighted Moving Average (WMA) and Adaptive Moving Average (ALMA) are mainly used.
The strategy first calculates the medium-term and short-term moving averages, ma1 and ma2, of the price, where ma1 has a shorter cycle and ma2 has a longer cycle. Then it calculates the difference between ma1 and ma2 as ma3, and further computes the smoothed moving average ma4 of ma3. When ma3 crosses over ma4 upwards, a buy signal is generated. When it crosses downwards, a sell signal is generated.
Thus, ma3 reflects the medium-term trend of the price, and ma4 filters some noise from ma3 to form a more reliable trading signal. The cycles of ma1 and ma2 are set by the parameter maLen. Users can optimize parameters to achieve the best setting for different markets.
The advantages of this strategy include:
There are also some risks for this strategy:
The strategy can be optimized from the following aspects:
The strategy generates trading signals based on the golden cross and dead cross of moving averages. By using ALMA and multi-cycle price averaging, the signals become more precise and reliable. The adjustable parameters make it widely applicable. Also, the logic is simple and clear and performs well in trending markets. Therefore, it has high practical value.
/*backtest start: 2024-01-08 00:00:00 end: 2024-01-15 00:00:00 period: 10m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy("Oracle Move Strategy", overlay=true) maLen = input(30, "ma period") mode = input(defval="wma", options=["alma", "ema", "wma"]) price = close ma(src, len) => mode=="alma" ? alma(src, len, 0.85, 6) : mode=="ema"? ema(src, len) : wma(src, len) ma1 = ma(price, floor(maLen / 2)) ma2 = ma(price, maLen) ma3 = 2.0 * ma1 - ma2 ma4 = ma(ma3, floor(sqrt(maLen))) //plot(ma1, color = red) //plot(ma2, color = green) plot(ma3, color = blue) plot(ma4, color = orange) mafast = ma3 maslow = ma4 if (crossover(mafast, maslow)) strategy.entry("MA2CrossLE", strategy.long, comment="MA2CrossLE") if (crossunder(mafast, maslow)) strategy.entry("MA2CrossSE", strategy.short, comment="MA2CrossSE") //plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)