Strategy vault / Mean reversion
Reversal Trading Strategy Based on Multi Period RSI
This article explains in detail a quantitative trading strategy that utilizes multi-period RSI indicators to identify reversal points. It analyzes multiple RSI indicators simultaneously to spot market turning points…
This article explains in detail a quantitative trading strategy that utilizes multi-period RSI indicators to identify reversal points. It analyzes multiple RSI indicators simultaneously to spot market turning points.
I. Strategy Logic
The strategy employs 3 groups of RSI indicators with different parameters:
Calculate RSI values for period 2, 7, and 14 respectively.
When RSI-2 is below 10, RSI-7 below 20, and RSI-14 below 30, a bottom is identified.
When RSI-2 is above 90, RSI-7 above 80, and RSI-14 above 70, a top is identified.
Generate buy/sell signals based on RSI unanimity.
Preset adjustable parameters for indicator consensus, controlling signal frequency.
By analyzing RSI indicators across periods collectively, reversal point accuracy can be improved.
II. Advantages of the Strategy
The biggest advantage is using multiple timeframe RSI analysis improves identification of key points and filters out false signals.
Another advantage is the flexibility to adjust consensus parameters and adapt to different market environments.
Lastly, the RSI combinations also provide more tuning options.
III. Potential Risks
However, the following risks exist:
Firstly, RSI itself has inherent lag in identifying reversals.
Secondly, multiple indicators introduce signal ambiguity requiring clear rules.
Finally, reversal trades have a failure rate requiring psychological preparation.
IV. Summary
In summary, this article has explained a quantitative strategy of identifying reversals based on multi-period RSI analysis. It improves recognition of market turning points by judging RSI unanimity. But risks like lagging and wrong signals need to be managed. Overall it provides a flexible RSI strategy optimization approach.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Long |
| v_input_2 | true | Short |
| v_input_3 | true | leverage |
| v_input_4 | 3 | Indicators |
| v_input_5 | 3 | accuracy |
| v_input_6 | 1900 | From Year |
| v_input_7 | 2100 | To Year |
| v_input_8 | true | From Month |
| v_input_9 | 12 | To Month |
| v_input_10 | true | From day |
| v_input_11 | 31 | To day |
Source Pine Script
/*backtest
start: 2023-09-06 00:00:00
end: 2023-09-13 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Noro's Triple RSI Top/Bottom v1.1", shorttitle = "3RSI Top/Bottom 1.1", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
leverage = input(1, defval = 1, minval = 1, maxval = 100, title = "leverage")
indi = input(3, defval = 3, minval = 1, maxval = 3, title = "Indicators")
accuracy = input(3, defval = 3, minval = 1, maxval = 10, title = "accuracy")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//RSI-2
fastup = rma(max(change(close), 0), 2)
fastdown = rma(-min(change(close), 0), 2)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
//RSI-7
middleup = rma(max(change(close), 0), 7)
middledown = rma(-min(change(close), 0), 7)
middlersi = middledown == 0 ? 100 : middleup == 0 ? 0 : 100 - (100 / (1 + middleup / middledown))
//RSI-14
slowup = rma(max(change(close), 0), 14)
slowdown = rma(-min(change(close), 0), 14)
slowrsi = slowdown == 0 ? 100 : slowup == 0 ? 0 : 100 - (100 / (1 + slowup / slowdown))
//Body
body = abs(close - open)
abody = sma(body, 10)
//Signals
acc = 10 - accuracy
signalup1 = fastrsi < (5 + acc) ? 1 : 0
signalup2 = middlersi < (10 + acc * 2) ? 1 : 0
signalup3 = slowrsi < (15 + acc * 3) ? 1 : 0
signaldn1 = fastrsi > (95 - acc) ? 1 : 0
signaldn2 = middlersi > (90 - acc * 2) ? 1 : 0
signaldn3 = slowrsi > (85 - acc * 3) ? 1 : 0
up = signalup1 + signalup2 + signalup3 >= indi
dn = signaldn1 + signaldn2 + signaldn3 >= indi
exit = ((strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)) and body > abody / 3
//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * leverage : lot[1]
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Bottom", strategy.long, needlong == false ? 0 : lot)
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Top", strategy.short, needshort == false ? 0 : lot)
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
strategy.close_all()Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-14. 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-Trading-Strategy-Based-on-Multi-Period-RSI.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
- Adaptive Mean Reversion Trading Strategy Based on Chande Momentum OscillatorPine Script · Mean reversion · 1d
- 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
- Advanced Strategy with Volume and Price Pullback Multiple Take ProfitPine Script · Mean reversion · 1h
- BONK Multi Factor Trading StrategyPine Script · Mean reversion · 1d