Reversal Prediction and Oscillator Combo Strategy

Author: ChaoZhang, Date: 2023-10-10 10:39:44
Tags:

Overview

This strategy combines reversal and oscillator strategies to obtain more reliable trading signals. It incorporates the reversal prediction strategy and Chande Forecast Oscillator strategy, executing trades when both strategies generate concurrent buy or sell signals.

Strategy Logic

  1. Reversal Prediction Strategy

    • Use Stochastic oscillator to identify overbought and oversold conditions

    • Take counter directional trades when price closes reversal over 2 bars while Stochastic oscillator reaches overbought or oversold levels

  2. Chande Forecast Oscillator Strategy

    • Use linear regression analysis to forecast prices

    • Oscillator plots the percentage difference between closing price and forecast price

    • Generate trading signals when actual price deviates significantly from forecast price

  3. Strategy Rules

    • Concurrently compute signals from both strategies

    • Only generate actual trading signals when both strategies agree on buy or sell

    • Combination filters false signals from individual strategies, improving reliability

Advantage Analysis

  1. Combining multiple strategies provides more robust market assessment

  2. Filters out false signals that may occur in single indicators

  3. Reversal strategy captures short-term reversal opportunities

  4. Chande oscillator accurately judges long-term trends

  5. Flexible Stochastic oscillator parameters adaptable to changing markets

  6. Blends analysis techniques to capitalize on diverse trading prospects

Risk Analysis

  1. Although more reliable, combo strategies reduce signal frequency

  2. Requires complex optimization of multiple strategy parameters

  3. Difficult to time reversals, risks of losses exist

  4. Linear regression forecast ineffective when prices are volatile

  5. Watch for price divergence from Stochastic oscillator

  6. Backtest data insufficient, live performance uncertain

Improvement Opportunities

  1. Optimize Stochastic oscillator by reducing K and D periods

  2. Test more linear regression periods to find optimal

  3. Add stop loss to limit losses

  4. Tweak logic to await Stochastic oscillator reaches extremes

  5. Analyze statistical properties of trading instruments

  6. Incorporate more indicators like MACD for robustness

Summary

This strategy synthesizes multiple analytical techniques and improves signal quality through combination, capturing both short-term reversals and long-term trends. But live performance needs to be validated and parameters tuned accordingly. The conceptual framework can be extended to more indicators and strategies, providing practical trading guidance. Overall the strategy offers meaningful innovations and references.


/*backtest
start: 2023-09-09 00:00:00
end: 2023-10-09 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 08/08/2019
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// 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.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos

ChandeForecastOscillator(Length, Offset) =>
    pos = 0
    xLG = linreg(close, Length, Offset)
    xCFO = ((close -xLG) * 100) / close
    pos := iff(xCFO > 0, 1,
           iff(xCFO < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Chande Forecast Oscillator", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthCFO = input(14, minval=1)
Offset = input(0)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posChandeForecastOscillator = ChandeForecastOscillator(LengthCFO, Offset)
pos = iff(posReversal123 == 1 and posChandeForecastOscillator == 1 , 1,
	   iff(posReversal123 == -1 and posChandeForecastOscillator == -1, -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)	 
if (possig == 0) 
    strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

More