This strategy is a trend following system that combines multiple period moving averages with Volume Weighted Average Price (VWAP). The strategy identifies trend direction through the crossover of three Simple Moving Averages (SMA) - 9-period, 50-period, and 200-period, while using VWAP as a price strength confirmation indicator, implementing a multi-dimensional trading signal confirmation mechanism. The strategy is suitable for both intraday trading (1-minute chart) and swing trading (1-hour chart).
The core logic of the strategy is built on several key elements:
Long entry conditions require:
Short entry conditions require:
Risk control suggestions:
This is a complete trading system combining multiple period moving averages and VWAP, providing reliable trading signals through multiple confirmation mechanisms. The strategy’s strengths lie in its clear logic, ease of execution, and good risk control capabilities. While it has certain risks related to lag and parameter sensitivity, these can be addressed through the suggested optimization directions to further enhance stability and adaptability. The strategy serves as a solid foundation framework that traders can customize according to their trading style and market environment.
/*backtest start: 2024-12-06 00:00:00 end: 2025-01-05 00:00:00 period: 2h basePeriod: 2h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("SMA Crossover Strategy with VWAP", overlay=true) // Input lengths for SMAs sma9Length = 9 sma50Length = 50 sma200Length = 200 // Calculate SMAs sma9 = ta.sma(close, sma9Length) // 9-period SMA sma50 = ta.sma(close, sma50Length) // 50-period SMA sma200 = ta.sma(close, sma200Length) // 200-period SMA // Calculate VWAP vwapValue = ta.vwap(close) // Long entry condition: SMA 9 crosses above SMA 50 and SMA 200 is less than SMA 50, and close is above VWAP longCondition = ta.crossover(sma9, sma50) and (sma200 < sma50) and (close > vwapValue) if (longCondition) strategy.entry("Long", strategy.long) // Exit condition for long: SMA 9 crosses below SMA 50 longExitCondition = ta.crossunder(sma9, sma50) if (longExitCondition) strategy.close("Long") // Short entry condition: SMA 9 crosses below SMA 50 and SMA 200 is greater than SMA 50, and close is below VWAP shortCondition = ta.crossunder(sma9, sma50) and (sma200 > sma50) and (close < vwapValue) if (shortCondition) strategy.entry("Short", strategy.short) // Exit condition for short: SMA 9 crosses above SMA 50 shortExitCondition = ta.crossover(sma9, sma50) if (shortExitCondition) strategy.close("Short") // Plotting the indicators on the chart plot(sma9, color=color.blue, title="SMA 9") plot(sma50, color=color.orange, title="SMA 50") plot(sma200, color=color.red, title="SMA 200") plot(vwapValue, color=color.green, title="VWAP")