Strategy vault / Mean reversion
Momentum Indicator RSI Reversal Trading Strategy
This strategy first calculates ADX and SMA on higher timeframes to identify trend direction and changes. Then RSI is calculated on lower timeframes to identify overbought and oversold conditions to generate trading…

Overview
This strategy first calculates ADX and SMA on higher timeframes to identify trend direction and changes. Then RSI is calculated on lower timeframes to identify overbought and oversold conditions to generate trading signals.
Strategy Logic
ADX on higher timeframes judges the strength of the trend. Rising ADX represents strengthening trend.
SMA on higher timeframes judges the direction of the trend. Rising SMA represents rising prices, falling SMA represents falling prices.
RSI on lower timeframes judges overbought and oversold conditions. RSI above threshold means overbought, RSI below threshold means oversold.
When ADX rises, SMA rises, and RSI overbought on lower timeframe, it's considered the uptrend is strengthening, go short here.
When ADX rises, SMA falls, and RSI oversold on lower timeframe, it's considered the downtrend is strengthening, go long here.
Advantage Analysis
Combines trend judgment and reversal trading, can capture reversal opportunities in major trends.
Utilizes indicators across timeframes, improves reliability of signals.
RSI strategy is simple to understand and implement.
Risk Analysis
Potential for false RSI signals, causing losing trades. Can optimize parameters to reduce false signals.
Major cycle trend judgment can be wrong, making strategy not suitable for market condition. Can consider more indicators for trend judgment.
Potentially high trading frequency, impacting profitability due to transaction costs. Can adjust RSI parameters to reduce number of trades.
Optimization Directions
Test more parameter combinations to find optimal match between RSI and ADX, SMA parameters.
Add stop loss mechanism to control single trade loss.
Consider volatility indicator to reduce position size when volatility is low.
Optimize specific entry and exit prices, like entering short upon breaking previous bar's high.
Conclusion
This strategy combines trend judgment and reversal signals to find local reversals within major trends. Compared to solely using RSI, it is more reliable and avoids being trapped. Overall a relatively conservative strategy suitable for investors looking to reduce false signals. Further parameter testing and mechanism optimization can improve strategy performance.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Custom Resolution / TF ? |
| v_input_2 | 180 | Custom Resolution / TF |
| v_input_3 | 14 | ADX Smoothing |
| v_input_4 | 14 | DI Length |
| v_input_5 | 7 | RSI length |
| v_input_6 | 28 | RSI oversold |
| v_input_7 | 68 | RSI overbought |
| v_input_8 | 20 | SMA HTF Length |
Source Pine Script
/*backtest
start: 2022-12-27 00:00:00
end: 2024-01-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("RSI scalping", overlay=true)
CustSession = input(defval=true,title= "Custom Resolution / TF ? ",type=bool)
SessionTF0 = input(title="Custom Resolution / TF", defval="180")
adxlen = input(14, title="ADX Smoothing")
dilen = input(14, title="DI Length")
length = input(7, title= "RSI length")
overSold = input( 28, title= "RSI oversold" )
overBought = input( 68, title= "RSI overbought" )
RSI = rsi(close, 7)
res = CustSession ? SessionTF0 : period
o = request.security(syminfo.tickerid, res, open)
c = request.security(syminfo.tickerid, res, close)
l = request.security(syminfo.tickerid, res, low)
h = request.security(syminfo.tickerid, res, high)
// ADX higher time frame
dirmov(len) =>
up = change(h)
down = -change(l)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
truer = request.security(syminfo.tickerid, res, tr)
truerange = rma(truer, len)
plus = fixnan(100 * rma(plusDM, len) / truerange)
minus = fixnan(100 * rma(minusDM, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(dilen, adxlen)
// SMA higher time frame
len = input(20, minval=1, title="SMA HTF Length")
smma = 0.0
smma := na(smma[1]) ? sma(c, len) : (smma[1] * (len - 1) + c) / len
ADXrising = (sig > sig[1]) and (sig[1] > sig[2]) and (sig[2] > sig[3]) and (sig > 15)
SMAdrop= (smma < smma[1]) and (smma[1] < smma[2]) and (smma[2] < smma[3])
SMArising = (smma > smma[1]) and (smma[1] > smma[2]) and (smma[2] > smma[3])
longCondition = crossover(RSI, overBought) and ADXrising and SMArising
shortCondition = crossunder(RSI, overSold) and SMAdrop and ADXrising
if (longCondition)
strategy.entry("Long entry", strategy.long)
if (shortCondition)
strategy.entry("Short Entry", strategy.short)Published by ChaoZhang on the FMZ strategy square · last modified 2024-01-03. 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/Momentum-Indicator-RSI-Reversal-Trading-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 Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d
- Multi Indicator Reversal Point Capture Trading StrategyPine Script · Mean reversion · 1d
- Reversal Trading Strategy with Bollinger Bands RSI ADX and ATRPine Script · Mean reversion · 1h
- Trend Reversal Momentum Indicators Crossover Tracking StrategyPine Script · Mean reversion · 1h
- Multi Dimensional Technical Indicator Cross Confirmation Buy Signal Optimization StrategyPine Script · Mean reversion · 1d
- Multi Factor Strategy CombinationPine Script · Mean reversion · 1m