This strategy optimizes the traditional pivot points reversal strategy by calculating the ATR and setting ATR filters to eliminate insignificant pivot points, only trading on truly significant ones.
The core logic is to identify significant peak and trough pivot points. The key steps to calculate significant peak pivots are:
The logic for calculating significant trough pivots is similar.
After obtaining the significant pivots, go short when price breaks an important peak pivot, and go long when it breaks an important trough pivot.
The main advantages of this strategy are:
The main risks are:
To control the above risks, optimize from the following aspects:
Further optimization directions include:
Combining with other indicators to determine market regime, avoiding trading reversals in trending markets. Consider MACD, KDJ etc.
Adding machine learning algorithms to auto-optimize parameters. Methods like genetic algorithms, random forest can be used to find optimum parameter sets.
Training models using quantitative data to find optimal ATR range. More historical data improves parameter selection accuracy.
Consider combining with other strategies, utilizing strengths of different strategy types. For example, combining with trend following strategy, reverse during ranging, trend-follow during sustained trends.
This significant pivot reversal strategy filters out meaningless minor fluctuations by calculating ATR and setting filters. Only trading reversals on significant pivots can effectively improve strategy profitability. Meanwhile, it also increases parameter optimization difficulty. The optimal parameters need to be found by comprehensive consideration of ATR range, stop loss/take profit ratios etc. If optimized thoroughly, it can become a highly efficient and stable short-term trading strategy.
/*backtest start: 2023-12-01 00:00:00 end: 2023-12-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("QuantNomad - Significant Pivot Reversal Strategy", shorttitle = "SPPS", overlay=true) // Inputs leftBars = input(4, title = 'PP Left Bars') rightBars = input(2, title = 'PP Right Bars') atr_length = input(14, title = 'ATR Length') atr_mult = input(0.1, title = 'ATR Mult') // Pivot High Significant Function pivotHighSig(left, right) => pp_ok = true atr = atr(atr_length) for i = 1 to left if (high[right] < high[right+i] + atr * atr_mult) pp_ok := false for i = 0 to right-1 if (high[right] < high[i] + atr * atr_mult) pp_ok := false pp_ok ? high[right] : na // Pivot Low Significant Function pivotLowSig(left, right) => pp_ok = true atr = atr(atr_length) for i = 1 to left if (low[right] > low[right+i] - atr * atr_mult) pp_ok := false for i = 0 to right-1 if (low[right] > low[i] - atr * atr_mult) pp_ok := false pp_ok ? low[right] : na swh = pivotHighSig(leftBars, rightBars) swl = pivotLowSig (leftBars, rightBars) swh_cond = not na(swh) hprice = 0.0 hprice := swh_cond ? swh : hprice[1] le = false le := swh_cond ? true : (le[1] and high > hprice ? false : le[1]) if (le) strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick) swl_cond = not na(swl) lprice = 0.0 lprice := swl_cond ? swl : lprice[1] se = false se := swl_cond ? true : (se[1] and low < lprice ? false : se[1]) if (se) strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6