0bps

Strategy vault / Mean reversion

Multi factor Reversal Tracking Strategy

The multi-factor reversal tracking strategy generates trading signals by incorporating price reversal patterns and overbought-oversold indicators. It synthesizes multiple factors to identify market highs and lows and…

Author
ChaoZhang
Complexity
Intermediate · 76 lines
Parameters
9
Backtest bar
2h · intraday
Tested on
BTC/USDT · futures

Strategy Overview

The multi-factor reversal tracking strategy generates trading signals by incorporating price reversal patterns and overbought-oversold indicators. It synthesizes multiple factors to identify market highs and lows and produces trade signals at reversal points to capture medium-short term price reversals.

Strategy Logic

The strategy consists of two modules:

  1. 123 Reversal Pattern Module
  • Go short when seeing 2-day new high but pullback on 3rd day, indicating potential short-term high.

  • Go long when seeing 2-day new low but bounce on 3rd day, indicating potential short-term low.

  1. Reverse Engineered RSI Module
  • Identify reversal points by dynamically adjusting RSI overbought and oversold lines.

  • Go short when RSI above adjusted overbought line, go long when RSI below adjusted oversold line.

Trading signals are only generated when both modules align.

The biggest advantage is incorporating multiple factors to determine structural highs and lows, filtering some false signals from individual factors, and improving actual trading win rate.

Advantages of the Strategy

  • Multi-factor synthesis for comprehensive high/low identification

  • Combines reversal patterns and overbought/oversold indicators

  • Filters false reversals, improves accuracy

  • Optimizable backtest parameters adaptable to different markets

  • Easy to implement for quick replication

Risk Warnings

  • Reversal signals may lag, parameter update needed

  • Prevent overtrading to avoid more commissions

  • Fundamentals of individual stocks still need to be considered

  • Reversal strategies more suitable for indexes and hot stocks

Conclusion

The multi-factor reversal tracking strategy perfectly combines the strengths of quant tools and manual analysis experience by considering multiple perspectives for trade signals. Compared to single indicator strategies, it significantly enhances actual trading stability and win rate. The strategy is worth verifying and optimizing in backtests first, then gradually implementing in live trading, with very pronounced practical value.

Parameters

NameDefaultWhat it controls
v_input_1true---- 123 Reversal ----
v_input_214Length
v_input_3trueKSmoothing
v_input_43DLength
v_input_550Level
v_input_6true---- Reverse Engineering RSI ----
v_input_750Value
v_input_814WildPer
v_input_9falseTrade reverse

Source Pine Script

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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 15/06/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
// The related article is copyrighted material from
// Stocks & Commodities.
//
// 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


RE_RSI(Value,WildPer) =>
    pos = 0.0
    AUC = 0.0
    ADC = 0.0
    ExpPer = 2 * WildPer - 1
    K = 2 / (ExpPer + 1)
    AUC := iff(close > close[1], K * (close - close[1]) + (1 - K) * nz(AUC[1], 1), (1-K) * nz(AUC[1], 1))
    ADC := iff(close > close[1], (1-K) * nz(ADC[1], 1), K * (close[1] - close) + (1 - K) * nz(ADC[1], 1))
    nVal = (WildPer - 1) * (ADC * Value / (100 - Value) - AUC)
    nRes = iff(nVal >= 0, close + nVal, close + nVal * (100 - Value) / Value)
    pos:= iff(nRes > close, -1,
    	   iff(nRes < close, 1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Reverse Engineering RSI, by Giorgos Siligardos", 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)
//-------------------------
line2 = input(true, "---- Reverse Engineering RSI ----")
Value = input(50, minval=1)
WildPer = input(14,minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posRE_RSI = RE_RSI(Value,WildPer)
pos = iff(posReversal123 == 1 and posRE_RSI == 1 , 1,
	   iff(posReversal123 == -1 and posRE_RSI == -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 )

Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-01. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Multi-factor-Reversal-Tracking-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open