This strategy backtests the Pivot Point Forecast Oscillator developed by Tushar Chande. The oscillator calculates the percentage difference between the closing price and the n-period linear regression forecasted price. It crosses above 0 when the forecast price is greater than the closing price and crosses below 0 when less than. This can be used to identify turning points in the market.
The strategy utilizes the Pivot Point Forecast Oscillator to determine market direction. Specifically, it calculates the percentage difference between the n-period linear regression forecasted price and the actual closing price. When the percentage difference crosses above 0, it goes long. When the percentage difference crosses below 0, it goes short. The complete trading logic is as follows:
The strategy is simple and straight-forward, comparing actual price with forecast price to determine if the market is overestimated or underestimated, thus generating trading signals.
The strategy has the following advantages:
The strategy also has some risks:
Counter measures:
The strategy can be improved in the following aspects:
The Pivot Point Forecast Oscillator is a quant trading strategy utilizing linear regression forecast prices. The strategy has simple logic and flexible parameters, generating clear trading signals. There is room for further improvement in optimizing stop loss, parameter selection, combining other indicator signals etc, to achieve better trading performance.
/*backtest start: 2022-12-13 00:00:00 end: 2023-12-19 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=2 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 19/03/2018 // The Chande Forecast Oscillator developed by Tushar Chande The Forecast // Oscillator plots the percentage difference between the closing price and // the n-period linear regression forecasted price. The oscillator is above // zero when the forecast price is greater than the closing price and less // than zero if it is below. // // You can change long to short in the Input Settings // WARNING: // - For purpose educate only // - This script to change bars colors. //////////////////////////////////////////////////////////// strategy(title="Chande Forecast Oscillator Backtest", shorttitle="CFO") Length = input(14, minval=1) Offset = input(0) reverse = input(false, title="Trade reverse") hline(0, color=black, linestyle=line) xLG = linreg(close, Length, Offset) xCFO = ((close -xLG) * 100) / close pos = iff(xCFO > 0, 1, iff(xCFO < 0, -1, nz(pos[1], 0))) possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos)) if (possig == 1) strategy.entry("Long", strategy.long) if (possig == -1) strategy.entry("Short", strategy.short) barcolor(possig == -1 ? red: possig == 1 ? green : blue ) plot(xCFO, color=red, title="CFO")