The Four WMA Trend Tracking strategy is a quantitative trading strategy that utilizes four weighted moving averages (WMA) of different timeframes to identify price trend reversals in stocks and establish long or short positions when those reversals happen. It also implements stop loss and take profit mechanisms to control risks.
The strategy employs four WMA lines. Two longer period WMAs (longM1 and longM2) are used to identify uptrends and long entry signals, while the other two shorter period WMAs (shortM1 and shortM2) are for identifying downtrends and short entry signals. The specific trading rules are:
When the shorter period WMA crosses below the longer period WMA, a long signal is generated and a long position is established.
When the shorter period WMA crosses above the longer period WMA, a short signal is generated and a short position is established.
Take profit and stop loss levels are set for each position based on the input percentage of the entry price.
When price reaches either take profit or stop loss level, the corresponding position is closed.
In essence, this strategy tracks potential turning points of price trends by observing crossover of the contraction and expansion of moving average lines, entering positions on those signals, and then managing risks/profits with stop loss and take profit.
The Four WMA Trend Tracking Strategy has the following advantages:
There are also some potential risks of this strategy:
To mitigate the risks, considerations include combining other indicators to confirm signals, optimizing entry rules and stop loss, or manual intervention during abnormal markets.
Some directions to optimize the strategy:
In summary, the Four WMA Trend Tracking Strategy is a relatively straightforward trend tracking strategy. It identifies potential turning points with crossover of multiple moving averages and manages trades with stop loss/take profit. When properly configured, it can perform well for stable stocks. However, traders should be aware of potential false signals and fine-tune parameters to suit real market regimes when applying it.
/*backtest start: 2024-01-22 00:00:00 end: 2024-02-21 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@rosedenvy //@version=5 strategy("Four WMA Strategy with TP and SL", shorttitle="4WMA TP/SL", overlay=true) // Inputs for WMA lengths longM1 = input.int(10, title="Long WMA1") longM2 = input.int(20, title="Long WMA2") shortM1 = input.int(30, title="Short WMA1") shortM2 = input.int(40, title="Short WMA2") // Inputs for TP and SL tp_percent = input.float(1.0, title="Take Profit %") / 100 sl_percent = input.float(1.0, title="Stop Loss %") / 100 // Calculating WMAs longWMA1 = ta.wma(close, longM1) longWMA2 = ta.wma(close, longM2) shortWMA1 = ta.wma(close, shortM1) shortWMA2 = ta.wma(close, shortM2) // Entry Conditions longCondition = ta.crossunder(longWMA1, longWMA2) shortCondition = ta.crossunder(shortWMA2, shortWMA1) // Strategy Entry if (longCondition) strategy.entry("Long", strategy.long, comment = "Long entry") strategy.exit("Long TP/SL", "Long", limit=close * (1 + tp_percent), stop=close * (1 - sl_percent), comment = "Long Exit" ) if (shortCondition) strategy.entry("Short", strategy.short, comment = "Short entry") strategy.exit("Short TP/SL", "Short", limit=close * (1 - tp_percent), stop=close * (1 + sl_percent), comment = "Short Exit") // Plotting WMAs plot(longWMA1, color=color.blue) plot(longWMA2, color=color.orange) plot(shortWMA1, color=color.red) plot(shortWMA2, color=color.purple)