123 Reversal Moving Average Convergence Divergence Combination Strategy

Author: ChaoZhang, Date: 2023-11-22 14:49:41



This strategy combines the 123 reversal trading strategy proposed by Ulf Jensen in his book with the Moving Average Convergence Divergence Oscillator (KST) proposed by Martin Pring to build a quantitative strategy that generates trading signals by utilizing reversal patterns and trend oscillation indicators.

Strategy Principle

123 Reversal Formation Mechanism

The core logic of this part of the strategy is to monitor whether the closing price of the stock has reversed in the past 2 days, specifically:

If the closing prices in the past 2 days are in a downward trend, that is, the previous day’s closing price is higher than the one before; and today’s closing price rebounds upward from the previous day, which is higher than the previous day’s closing price, it can be judged as a bottom reversal and a buy signal is generated.

On the contrary, if the closing prices in the past 2 days are in an upward trend, that is, the previous day’s closing price is lower than the one before; and today’s closing price falls from the previous day, which is lower than the previous day’s closing price, it can be judged as a top reversal and a sell signal is generated.

This part of the strategy also combines the Stochastic indicator to determine whether it is overbought or oversold to filter out non-reversal trading signals.

KST Indicator Principle

In the KST indicator, ROC represents the rate of change in price, calculating the ROCs of 6 days, 10 days, 15 days and 20 days respectively, and performing weighted summation after different parameter moving average smoothing to construct the KST indicator.

When the fast line crosses above the slow line, it is judged as bullish; when the fast line crosses below the slow line, it is judged as bearish. Here, the fast line is the original KST value, and the slow line is the moving average of KST.

This strategy uses KST>0 to judge bullish and KST<0 to judge bearish.

Signal Merge

The Judgment signals of the 123 reversal strategy and the KST indicator are combined:

  • If both signals are the same, a trading signal is generated in that direction
  • If the two signals are different, no trading occurs

It can be seen that this strategy comprehensively uses two different types of technical indicators, the reversal pattern and indicator judgment, and combines their signal strengths to design a more advanced quantitative trading strategy.

Advantages of the Strategy

  • The reversal part can effectively identify turning points, and the indicator part can track trends, complementing each other
  • Filtering with dual indicators can improve signal quality and reduce false signals
  • Flexible adjustment of KST parameters for optimization for stocks of different cycles
  • Can adapt to high volatility stocks, can also be used for relatively stable stocks

Risks of the Strategy

  • Risk of reversal failure, reversal signal may also be false breakout
  • Some opportunities may be missed after signal merge
  • Improper KST parameters may greatly interfere with results
  • When stock price fluctuates sharply, KST lags, inconsistent signals may appear

Methods like parameter adjustment, optimization of reversal logic, introduction of stop loss mechanism can be used to control risks.

Optimization Direction

  • Optimize Stochastic Parameters
  • Optimize length parameters of KST line
  • Add trading volume or volatility index filter
  • Add trend judgment to avoid trading against trend
  • Introduce stop loss mechanism


This strategy integrates multiple different types of technical indicators. Through dual confirmation and combination optimization, it scientifically designs a relatively strong quantitative trading strategy, and it is a model of strategy combination. Its performance in live trading is yet to be further verified, but from the theoretical conceptualization perspective, it comprehensively considers multiple scenarios, solves the limitations of single indicators, and is worth further research and application.

start: 2023-10-22 00:00:00
end: 2023-11-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

//  Copyright by HPotter v1.0 23/03/2021
// 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
// This indicator really is the KST indicator presented by Martin Pring. 
// the KST indicator is a weighted summed rate of change oscillator that 
// is designed to identify meaningful turns. Various smoothed rate of change 
// indicators can be combined to form different measurements of cycles. 
// - 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))) 

MROC() =>
    pos = 0.0
    xROC6 = sma(roc(close, 6), 10)
    xROC10 = sma(roc(close, 10), 10)
    xROC15 = sma(roc(close, 15), 9)
    xROC20 = sma(roc(close, 20), 15)
    nRes = xROC6 + (2 * xROC10) + (3 * xROC15) + (4 * xROC20)
    pos := iff(nRes > 0, 1,
    	     iff(nRes < 0, -1, nz(pos[1], 0))) 

strategy(title="Combo Backtest 123 Reversal & MovROC (KST indicator)", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posMROC = MROC()
pos = iff(posReversal123 == 1 and posMROC == 1 , 1,
	   iff(posReversal123 == -1 and posMROC == -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) 
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )