Strategy vault / Mean reversion
Dual Moving Average and RSI Reversal Trading Strategy
This strategy combines dual moving averages and the relative strength index (RSI) to identify short-term reversal opportunities during strong trends. It aims to enter trades against the momentum when the trend…

Overview
This strategy combines dual moving averages and the relative strength index (RSI) to identify short-term reversal opportunities during strong trends. It aims to enter trades against the momentum when the trend direction is clear, by using RSI to detect overbought and oversold conditions and waiting for the price to reverse. The strategy is suitable for markets with obvious trends, capturing partial reversals without trading against the overall trend.
Strategy Logic
Calculate the 30-day simple moving average (SMA) and 200-day exponential moving average (EMA) to determine the overall trend direction.
- SMA>EMA suggests an upward trend
- SMA<EMA suggests a downward trend
Calculate the 30-day RSI to identify overbought and oversold conditions.
- RSI<=53 is considered oversold
- RSI>=60 is considered overbought
Entry rules:
- Go long when in an upward trend (SMA>EMA) and RSI<=53
- Go short when in a downward trend (SMA<EMA) and RSI>=60
Exit rules:
- Close long position for stop loss or take profit
- Close short position for stop loss or take profit
Advantage Analysis
Follows the major trend, avoids trading against the trend
Conservative RSI settings avoid false signals
Dual moving average filter improves entry timing accuracy
Controllable risk, small drawdowns
Risk Analysis
Needs obvious trending markets, less effective in ranging markets
Conservative RSI settings may miss some opportunities
Stop loss placement needs to be reasonable to avoid premature exits
Improvement Directions
Optimize RSI parameters to find more entry opportunities
Test different moving average combinations
Add trend filter, only trade when trend is strong enough
Optimize stop loss strategy to control loss on single trades
Conclusion
The strategy has controllable risks overall, suitable for medium-long term position traders. It trades with the major trend direction, uses conservative RSI settings and strict moving average filters to avoid false breakouts, improving win rate. There is also room for potential improvements with parameter tuning to gain more opportunities. Risk control is essential to maintain a long-term trading mentality.
Source Pine Script
/*backtest
start: 2023-09-17 00:00:00
end: 2023-10-17 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//Based on Larry Connors RSI-2 Strategy - Lower RSI
strategy(title="_CM_RSI_2_Strat_Low", shorttitle="_CM_RSI_2_Strategy_Lower", overlay=false)
src = close,
//RSI CODE
up = rma(max(change(src), 0), 30)
down = rma(-min(change(src), 0), 30)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//Criteria for Moving Avg rules
ma50= vwma(close,30)
ma200= vwma(close,200)
//Rule for RSI Color
col = ma50 > ma200 and rsi <=53?lime: ma50 < ma200 and rsi >= 60?red : silver
long = ma50 > ma200 and rsi <= 53
short = ma50 < ma200 and rsi >= 60
//plot(rsi, title="RSI", style=line, linewidth=1,color=col)
//plot(100, title="Upper Line 100",style=line, linewidth=3, color=aqua)
//plot(0, title="Lower Line 0",style=line, linewidth=3, color=aqua)
//band1 = plot(60, title="Upper Line 60",style=line, linewidth=1, color=aqua)
//band0 = plot(44, title="Lower Line 40",style=line, linewidth=1, color=aqua)
//fill(band1, band0, color=silver, transp=90)
strategy.entry ("buy", strategy.long, when=long)
strategy.entry ("sell", strategy.short, when=short)
plot(long,"long",color=green,linewidth=1)
plot(short,"short",color=red,linewidth=1)Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-18. 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/Dual-Moving-Average-and-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 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d
- Advanced Quantitative Trading Strategy Combining RSI Divergence and Moving AveragesPine Script · Mean reversion · 1h
- BONK Multi Factor Trading StrategyPine Script · Mean reversion · 1d
- Customizable Non Repainting HTF MACD MFI Scalable Bot StrategyPine Script · Mean reversion · 1d
- Dual Moving Average Crossover with RSI Overbought Oversold Pyramid Dynamic Trend Trading StrategyPine Script · Mean reversion · 2h