This is a combination trading strategy based on simple moving averages (SMA). It uses a crossover of the 9-day and 21-day SMA lines as buy and sell signals. When the short-term SMA crosses above the long-term SMA from below, a buy signal is generated. When the short-term SMA crosses below the long-term SMA from above, a sell signal is generated.
The core logic of this strategy is to use two SMA lines with different parameters - a 9-day SMA representing the short-term trend and a 21-day SMA representing the long-term trend. When the short-term trend line crosses above the long-term trend line from below, it indicates the market is changing from downtrend to uptrend, generating a buy signal. When the short-term line crosses below the long-term line from above, it signals a change from uptrend to downtrend, generating a sell signal.
The key signals this strategy relies on are the “golden cross” and “death cross” of the two SMA lines. A golden cross occurs when the short SMA crosses above the long SMA, signaling a possible change from downtrend to uptrend. A death cross occurs when the short SMA crosses below the long SMA, suggesting a downturn from uptrend may start. By utilizing these two signals, the strategy identifies relationships between short-term and long-term trends to make trading decisions.
Possible Enhancements:
Overall this is a fairly traditional and simple dual moving average crossover system. It is easy to understand and implement with relatively simple parameter selection. It can effectively track changes between short-term and long-term trends. However, issues like false signals, empirically chosen parameters, mediocre performance in high volatility environments need to be addressed. Appropriate optimizations, enhancements, and combinations should be considered along with solid risk control practices.
/*backtest start: 2024-01-01 00:00:00 end: 2024-01-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Bitboy Strategy", overlay=true) // Define MAs SlowMA = ta.sma(close, 9) FastMA = ta.sma(close, 21) // Plot MAs plot1 = plot(SlowMA, color=color.new(color.red, 0), title="Slow MA") plot2 = plot(FastMA, color=color.new(color.green, 0), title="Fast MA") // Plot MA Ribbon fill(plot1, plot2, color=FastMA > SlowMA ? color.rgb(233, 21, 21, 50) : color.new(#1de223, 45)) // Define buy/sell conditions longCondition = ta.crossover(SlowMA, FastMA) shortCondition = ta.crossunder(SlowMA, FastMA) // Strategy commands for buy/sell if longCondition strategy.entry("Long", strategy.long) if shortCondition strategy.entry("Short", strategy.short) // Plot buy/sell signals (for visualization) plotshape(longCondition, location=location.belowbar, color=color.rgb(18, 230, 25, 37), style=shape.labelup, text="Buy", textcolor=color.white) plotshape(shortCondition, location=location.abovebar, color=color.rgb(239, 23, 23, 40), style=shape.labeldown, text="Sell", textcolor=color.white)