This strategy optimizes the original Rate of Change (ROC) strategy. Compared with the original ROC strategy, this strategy has the following optimizations:
Through these optimization measures, many invalid signals can be filtered out to make the strategy more stable and reliable.
The core indicator of this strategy is Rate of Change (ROC). ROC measures the rate of change in stock prices over a certain period. This strategy first calculates the ROC value over a period of 9. Then it records the maximum value of this ROC indicator in the past 200 periods and calculates the current ROC as a percentage of the maximum historical ROC to obtain the relative strength of momentum. For example, if the highest ROC in the past 200 days reached 100, then the relative strength is 80% when today’s ROC is 80.
The relative strength is smoothed by a 10-period SMA to filter out short-term fluctuations and obtain a smooth curve. When the smooth curve rises continuously for 3 days and the value is below -80%, it is considered that the stock price decline begins to slow down and the bottom sign appears, so go long; when the smooth curve falls continuously for 3 days and the value is above 80%, it is considered that the stock price increase begins to slow down and the top sign appears, so close position.
Compared with the original ROC strategy, this strategy has the following main advantages:
In general, this strategy effectively processes the ROC indicator to make it more suitable for live trading.
The main risks of this strategy are:
To reduce the above risks, consider combining trend indicators to determine major trends; adjust threshold parameters and test optimal parameters; optimize SMA cycle parameters.
The strategy can be optimized in the following ways:
This is an optimization strategy based on secondary development of the ROC indicator. It introduces means such as historical maximum value comparison, SMA smoothing, and buy and sell thresholds to filter out invalid signals and make the strategy more stable. The main advantage is the high signal quality which is suitable for live trading. Follow-up improvements can be made from combining trends, parameter optimization and so on to further improve strategy performance.
/*backtest start: 2024-02-12 00:00:00 end: 2024-02-19 00:00:00 period: 1m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy(title="Rate Of Change Mod Strategy", shorttitle="ROC", format=format.price, precision=2) //length = input.int(9, minval=1) //source = input(close, "Source") //roc = 100 * (source - source[length])/source[length] //plot(roc, color=#2962FF, title="ROC") //hline(0, color=#787B86, title="Zero Line") length = input.int(9, minval=1, title="Length") maxHistory = input(200, title="Max Historical Period for ROC") lenghtSmooth = input.int(10, minval=1, title="Length Smoothed ROC") lenghtBUY = input.int(-80, title="Buy Threshold") lenghtSELL = input.int(80, title="Buy Threshold") source = close roc = 100 * (source - source[length]) / source[length] // Calculate the maximum ROC value in the historical period maxRoc = ta.highest(roc, maxHistory) // Calculate current ROC as a percentage of the maximum historical ROC rocPercentage = (roc / maxRoc) * 100 rocPercentageS = ta.sma(rocPercentage, lenghtSmooth) if ta.rising(rocPercentageS, 3) and rocPercentageS < lenghtBUY strategy.entry("Buy", strategy.long) if ta.falling(rocPercentageS, 3) and rocPercentageS > lenghtSELL strategy.close("Buy") plot(rocPercentage, color=color.new(color.blue, 0), title="Percentage ROC") plot(rocPercentageS, color=color.new(#21f32c, 0), title="Percentage ROC") hline(0, color=color.new(color.gray, 0), title="Zero Line")