Strategy vault / Mean reversion
Fast RSI Reversal Strategy
This strategy is a fast RSI reversal trading strategy that mainly captures reversal opportunities when RSI is overbought or oversold. It uses 3-day RSI to judge overbought and oversold levels, and combines 30-day MA…
Here is an SEO article I wrote based on the code and requirements you provided, including the strategy name, overview, strategy principles, advantage analysis, risk analysis, optimization direction and summary, etc.:
Overview
This strategy is a fast RSI reversal trading strategy that mainly captures reversal opportunities when RSI is overbought or oversold. It uses 3-day RSI to judge overbought and oversold levels, and combines 30-day MA to determine breakthrough signals, opening positions when reversals occur after overbought or oversold status.
Strategy Logic
The strategy uses two indicators:
3-day RSI to judge overbought and oversold levels.
30-day MA to determine the strength of reversal signals. When the reversal bar body is greater than half of the 30-day MA, it is used as the entry signal.
Specific trading rules:
Long signal: When RSI is below the lower limit (default 25) and the current bar body is greater than half of the 30-day MA, go long.
Short signal: When RSI is above the upper limit (default 75) and the current bar body is greater than half of the 30-day MA, go short.
Exit signal: When holding long positions, if RSI crosses above the upper limit, or when holding short positions, if RSI crosses below the lower limit, meanwhile the bar body is greater than half of the 30-day MA, close positions.
Advantage Analysis
The advantages of this strategy include:
Using short-period RSI to capture short-term reversal opportunities quickly.
Increasing signal reliability by combining with MA filter, avoiding whipsaws in range-bound markets.
Controllable drawdowns, maximum drawdown won't be too large.
Clear position control rules, avoids over-trading.
Risk Analysis
The risks of this strategy include:
Failed reversal risk. Overbought and oversold does not necessarily lead to reversals.
Loss risk by trading against the trend in trending markets.
Missing opportunities due to too strict bar filter rules.
High parameter sensitivity, RSI and MA periods need adjustment.
Optimization Directions
The strategy can be optimized from the following aspects:
Optimize RSI parameters to find the optimal period.
Optimize MA parameters to determine the best bar filter period.
Add stop loss strategies like trailing stop loss, to control single trade loss.
Add trend determination rules to avoid trading against trends.
Conclusion
In conclusion, this is a short-term reversal-focused RSI strategy. It captures reversals by identifying quick RSI overbought and oversold levels, and uses MA bar filter to confirm entries. The advantages are controllable drawdowns and clear position controls. It is suitable for short-term trading but should watch out risks of failed reversals and trading against trends. It can be improved by parameter optimization, adding stop loss, and judging trends.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Long |
| v_input_2 | true | Short |
| v_input_3 | 25 | RSI limit |
| v_input_4 | 1900 | From Year |
| v_input_5 | 2100 | To Year |
| v_input_6 | true | From Month |
| v_input_7 | 12 | To Month |
| v_input_8 | true | From day |
| v_input_9 | 31 | To day |
Source Pine Script
/*backtest
start: 2023-10-31 00:00:00
end: 2023-11-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Noro's Fast RSI Strategy v1.0", shorttitle = "Fast RSI str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 5)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
limit = input(25, defval = 25, minval = 1, maxval = 100, title = "RSI limit")
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")
//Fast RSI
src = close
fastup = rma(max(change(src), 0), 3)
fastdown = rma(-min(change(src), 0), 3)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
uplimit = 100 - limit
dnlimit = limit
//Body
body = abs(close - open)
emabody = ema(body, 30) / 2
//Signals
bar = close > open ? 1 : close < open ? -1 : 0
up = bar == -1 and fastrsi < dnlimit and body > emabody
dn = bar == 1 and fastrsi > uplimit and body > emabody
exit = ((strategy.position_size > 0 and fastrsi > dnlimit) or (strategy.position_size < 0 and fastrsi < uplimit)) and body > emabody
//Trading
if up
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))
if dn
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))
if time > timestamp(toyear, tomonth, today, 00, 00) or exit
strategy.close_all()Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-01. 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/Fast-RSI-Reversal-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
- 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
- Chaikin Oscillator StrategyPine Script · Mean reversion · 3h