Strategy vault / Mean reversion
Reversal Momentum Compound Strategy
The Reversal Momentum Compound strategy combines a reversal strategy and a momentum strategy. By utilizing both price reversal signals and momentum indicator signals, it captures market turning points more precisely…

Overview
The Reversal Momentum Compound strategy combines a reversal strategy and a momentum strategy. By utilizing both price reversal signals and momentum indicator signals, it captures market turning points more precisely and gets in the market in a timely manner as price starts to reverse.
Strategy Logic
The strategy consists of two parts:
123 Reversal Strategy: Go long when close is higher than previous close for 2 consecutive days after 2 days of lower close, and 9-day slow K line is below 50; Go short when close is lower than previous close for 2 consecutive days after 2 days of higher close, and 9-day fast K line is above 50.
DAPD Momentum Breakout Strategy: DAPD is the average difference between 21-day high and 21-day low. Determine entry and exit points based on DAPD breakout.
A entry signal is generated when two strategies give aligned signals. Stay sideline when signals are conflicting.
Advantages
The strategy combines the merits of reversal and momentum strategies, capturing turning points more precisely. Main advantages:
Dual filter increases signal reliability. Higher success rate when signals align.
123 pattern reduces risk of whipsaws.
DAPD momentum suitable for trending products.
Risks
Signal timing mismatch risk. Signals from two strategies may not align perfectly.
Parameter tuning difficulty. Hard to optimize two sets of parameters together.
Doubled transaction cost risk. Commission fees apply to both strategies.
Optimization
Optimize signal alignment of two strategies.
Test effectiveness of different parameter sets on different products.
Only take high-conviction signals to filter out weak ones.
Conclusion
The Reversal Momentum Compound strategy captures reversing price timely by combining merits of reversal and momentum strategies. Dual filters increase success rate. Further performance improvement can be achieved by optimizing signal alignment. The strategy suits investors with sufficient capital and trading expertise.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 14 | Length |
| v_input_2 | true | KSmoothing |
| v_input_3 | 3 | DLength |
| v_input_4 | 50 | Level |
| v_input_5 | 21 | LengthDAPD |
| v_input_6 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2023-12-28 00:00:00
end: 2024-01-04 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 10/12/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
// This indicator is similar to Bollinger Bands. It based on DAPD - Daily
// Average Price Delta. DAPD is based upon a summation for each of the
// highs (hod) for the 21 days prior to today minus the summation for
// each of the lows (lod) for the last 21 days prior to today. The result
// of this calculation would then be divided by 21.
// It will be buy when high above previos DAPD high and sell if low below previos DAPD low
//
// 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
DAPD(Length) =>
pos = 0.0
xHighSMA = sma(high, Length)
xLowSMA = sma(low, Length)
nDAPD = xHighSMA - xLowSMA
nTop = high + nDAPD
nBottom = low - nDAPD
pos := iff(high > nTop[1], 1,
iff(low < nBottom[1], -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & DAPD", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthDAPD = input(21, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posDAPD = DAPD(LengthDAPD)
pos = iff(posReversal123 == 1 and posDAPD == 1 , 1,
iff(posReversal123 == -1 and posDAPD == -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 2024-01-05. 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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Reversal-Momentum-Compound-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Bollinger Bands Stochastic RSI Extreme Strategy BBSR Extreme StrategyPine Script · Mean reversion · 1h
- Dual Reversal Oscillating Band Trend Following StrategyPine Script · Mean reversion · 1h
- Modified Bollinger Bands StrategyPine Script · Mean reversion · 1h
- Multi Factor Strategy CombinationPine Script · Mean reversion · 1m
- Multi indicator Combined Quantitative Trading StrategyPine Script · Mean reversion · 1h