Strategy vault / Mean reversion
RSI Average Reversion Trading Strategy
This strategy uses RSI average based on multiple price inputs to determine overbought/oversold and trades mean-reversion.
Overview
This strategy uses RSI average based on multiple price inputs to determine overbought/oversold and trades mean-reversion.
Strategy Logic
Calculate RSI values based on close, open, high etc.
Take arithmetic average of the RSI values to derive RSI mean.
RSI mean above 0.5 indicates overbought, below 0.5 oversold.
RSI mean reversion to the 0.5 midpoint generates trading signals.
Set RSI mean exit thresholds, like close long above 0.65, close short below 0.35.
Simple and clear trading logic easy to implement.
Advantages
RSI mean improves stability using multiple price inputs.
Trading signals from RSI mean reversion, combining trend and reversal.
Intuitive RSI mean curve forms clear visual trading signals.
Default parameters simple and practical for mean reversion.
Concise code easy to understand and modify for beginners.
Risks
RSI prone to false reversal signals resulting in losses.
Inappropriate RSI parameters and threshold setups affect performance.
Relying solely on single RSI indicator leads to higher systematic risk.
Unable to confirm price reversal sustaining power.
Trending markets tend to produce losses.
Enhancement
Test and optimize RSI period for higher sensitivity.
Evaluate price input impacts on RSI mean.
Add trend filter to avoid counter-trend trades.
Incorporate other factors to confirm reversal signals.
Build dynamic stops mechanism for risk control.
Optimize entry, stop loss, take profit for higher efficiency.
Conclusion
This strategy trades RSI mean reversion simply and viably for beginners. But risks include signal errors and trends exist. Multi-factor optimization and risk management improvements can make the strategy more robust and efficient as a reliable reversal system.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_float_1 | 0.65 | v_input_float_1 |
| v_input_float_2 | 0.35 | v_input_float_2 |
| v_input_bool_1 | true | (?Entries Type)Allow Long entries |
| v_input_bool_2 | true | Allow Short entries |
Source Pine Script
/*backtest
start: 2022-09-13 00:00:00
end: 2023-09-19 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99
//@version=5
strategy("RSI Average Swing Bot")
long_only=input.bool(true, title="Allow Long entries", group="Entries Type")
short_only=input.bool(true, title="Allow Short entries", group="Entries Type")
rsiohlc4= ta.rsi(ohlc4,50)/100
rsiclose= ta.rsi(close,50)/100
rsiopen= ta.rsi(open,50)/100
rsihigh= ta.rsi(high,50)/100
rsihlc3= ta.rsi(hlc3,50)/100
rsihl2= ta.rsi(hl2,50)/100
hline(0.3, color=color.white, linestyle=hline.style_dashed, linewidth=2)
hline(0.5, color=color.white, linestyle=hline.style_dotted, linewidth=2)
hline(0.7, color=color.white, linestyle=hline.style_dashed, linewidth=2)
rsi_avg = (rsiohlc4+rsiclose+rsiopen+rsihigh+rsihl2+rsihlc3)/6
culoare = rsi_avg > 0.50? color.green : rsi_avg<0.50 ? color.red : color.yellow
plot(rsi_avg,color=culoare )
long = rsi_avg > 0.5 and rsi_avg[1]< 0.5
longexit = rsi_avg >= input.float(0.65, step=0.05)
short = rsi_avg < 0.5 and rsi_avg[1] >0.5
shortexit=rsi_avg<=input.float(0.35, step=0.05)
if(long_only)
strategy.entry("long",strategy.long,when=long)
strategy.close("long",when=longexit or short)
if(short_only)
strategy.entry("short",strategy.short,when=short)
strategy.close("short",when=shortexit or long)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-20. 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/RSI-Average-Reversion-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
- ATR and EMA based Dynamic Take Profit and Stop Loss Adaptive StrategyPine Script · Mean reversion · 1h
- Adaptive Mean Reversion Trading Strategy Based on Chande Momentum OscillatorPine Script · Mean reversion · 1d
- Adaptive RSI Oscillator Dynamic Trading Strategy with Threshold OptimizationPine Script · Mean reversion · 1d
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Advanced Fibonacci Retracement Trend Following and Reversal Trading StrategyPine Script · Mean reversion · 3h
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d