Fast RSI Risk Control Compound Futures Trading Strategy
This strategy is designed for the spot trading platform BitMEX. By analyzing the fast RSI indicator and combining multiple technical indicators to screen signals, it realizes efficient trend tracking trading. The…

Overview
This strategy is designed for the spot trading platform BitMEX. By analyzing the fast RSI indicator and combining multiple technical indicators to screen signals, it realizes efficient trend tracking trading. The strategy also sets risk management and stop loss mechanisms to effectively control trading risks.
Strategy Logic
Calculate fast RSI with parameters of 7 days and overbought line 25, oversold line 75. When RSI crosses over overbought line, it is an overbought signal. When RSI crosses below oversold line, it is an oversold signal.
Set filter on candlestick body. Require opening as bearish candle with body length no less than 20% of yesterday's average body length.
Set filter on candlestick color. Require last 4 candles as bearish when going short, and last 4 candles as bullish when going long.
Set stop loss logic. Close position when price moves in unfavorable direction.
Set anti-whipsaw mechanism. Only take signal when price recovers to stop loss level after initial move.
Set position sizing. Use fixed percentage of capital for each trade, and double position size after each loss.
Advantage Analysis
Fast RSI parameters set reasonably can quickly capture trends. Combining with candlestick body and color filters can avoid false breakouts effectively.
Multi-layer filter enhances win rate by reducing number of trades.
Built-in stop loss mechanism limits per trade loss.
Dynamic position sizing realizes moderately aggressive capital management.
Customizable trading time frame avoids noise from major events.
Risks and Optimizations
High speed may miss some trading opportunities. Can relax parameters for more flexibility.
Hard to determine trend ending. Consider combining with other indicators to detect potential reversals.
Position sizing method too aggressive, can introduce locking position way.
Can optimize parameters for different markets to find better parameter combinations.
Conclusion
Overall this strategy is quite robust. By judging trend direction with fast RSI and filtering signals with multiple indicators, it can get good returns during trends. Also the strategy has room for optimization. By adjusting parameter combinations it can adapt to different market environments, thus having good practicality.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Long |
| v_input_2 | true | Short |
| v_input_3 | true | Use Martingale |
| v_input_4 | 100 | Capital, % |
| v_input_5 | 7 | RSI Period |
| v_input_6 | 25 | RSI limit |
| v_input_7 | true | RSI Bars |
| v_input_8 | true | Use Open Color Filter |
| v_input_9 | true | Use Close Color Filter |
| v_input_10 | 4 | Open Color Bars |
| v_input_11 | true | Close Color Bars |
| v_input_12 | true | Use Open Body Filter |
| v_input_13 | true | Use Close Body Filter |
| v_input_14 | 20 | Open Body Minimum, % |
| v_input_15 | 50 | Close Body Minimum, % |
| v_input_16 | true | Use Close Norma Filter |
| v_input_17 | 1900 | From Year |
| v_input_18 | 2100 | To Year |
| v_input_19 | true | From Month |
| v_input_20 | 12 | To Month |
| v_input_21 | true | From Day |
| v_input_22 | 31 | To Day |
Source Pine Script
/*backtest
start: 2023-11-05 00:00:00
end: 2023-11-12 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Robot BitMEX Fast RSI v1.0", shorttitle = "Robot BitMEX Fast RSI v1.0", overlay = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 10)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usemar = input(true, defval = true, title = "Use Martingale")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
rsiperiod = input(7, defval = 7, minval = 2, maxval = 100, title = "RSI Period")
rsilimit = input(25, defval = 25, minval = 1, maxval = 30, title = "RSI limit")
rsibars = input(1, defval = 1, minval = 1, maxval = 20, title = "RSI Bars")
useocf = input(true, defval = true, title = "Use Open Color Filter")
useccf = input(true, defval = true, title = "Use Close Color Filter")
openbars = input(4, defval = 4, minval = 1, maxval = 20, title = "Open Color Bars")
closebars = input(1, defval = 1, minval = 1, maxval = 20, title = "Close Color Bars")
useobf = input(true, defval = true, title = "Use Open Body Filter")
usecbf = input(true, defval = true, title = "Use Close Body Filter")
openbody = input(20, defval = 20, minval = 0, maxval = 1000, title = "Open Body Minimum, %")
closebody = input(50, defval = 50, minval = 0, maxval = 1000, title = "Close Body Minimum, %")
usecnf = input(true, defval = true, title = "Use Close Norma Filter")
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
uprsi = rma(max(change(close), 0), rsiperiod)
dnrsi = rma(-min(change(close), 0), rsiperiod)
rsi = dnrsi == 0 ? 100 : uprsi == 0 ? 0 : 100 - (100 / (1 + uprsi / dnrsi))
uplimit = 100 - rsilimit
dnlimit = rsilimit
rsidn = rsi < dnlimit ? 1 : 0
rsiup = rsi > uplimit ? 1 : 0
rsidnok = sma(rsidn, rsibars) == 1
rsiupok = sma(rsiup, rsibars) == 1
//Body Filter
body = abs(close - open)
abody = sma(body, 10)
openbodyok = body >= abody / 100 * openbody or useobf == false
closebodyok = body >= abody / 100 * closebody or usecbf == false
//Color Filter
bar = close > open ? 1 : close < open ? -1 : 0
gbar = bar == 1 ? 1 : 0
rbar = bar == -1 ? 1 : 0
opengbarok = sma(gbar, openbars) == 1 or useocf == false
openrbarok = sma(rbar, openbars) == 1 or useocf == false
closebarok = (strategy.position_size > 0 and bar == 1) or (strategy.position_size < 0 and bar == -1) or useccf == false
//Norma Filter
norma = (rsi > dnlimit and rsi < uplimit) or usecnf == false
//Signals
up = openrbarok and rsidnok and openbodyok and (strategy.position_size == 0 or close < strategy.position_avg_price)
dn = opengbarok and rsiupok and openbodyok and (strategy.position_size == 0 or close > strategy.position_avg_price)
exit = ((strategy.position_size > 0 and closebarok and norma) or (strategy.position_size < 0 and closebarok and norma)) and closebodyok
//Indicator
plot(rsi, color = blue, linewidth = 3, title = "Double RSI")
plot(uplimit, color = black, title = "Upper Line")
plot(dnlimit, color = black, title = "Lower Line")
colbg = rsi > uplimit ? red : rsi < dnlimit ? lime : na
bgcolor(colbg, transp = 20)
//Trading
profit = exit ? ((strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price)) ? 1 : -1 : profit[1]
mult = usemar ? exit ? profit == -1 ? mult[1] * 2 : 1 : mult[1] : 1
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 * mult : lot[1]
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Short", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
strategy.close_all()Published by ChaoZhang on the FMZ strategy square · last modified 2023-11-13. 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-Risk-Control-Compound-Futures-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
- Bollinger Band Channel Breakout Trading StrategyPine Script · Breakout · 1d
- Bollinger Bands Dynamic Breakout StrategyPine Script · Breakout · 1h
- Bull Market Tracking SystemPine Script · Breakout · 1h
- Cross boundary Dynamic Range Quantitative Trading Strategy Based on Bollinger BandsPine Script · Breakout · 3h
- Dual MA Momentum Breakout StrategyPine Script · Breakout · 1h
- Dynamic Stop Loss Strategy Adaptive to ATR FluctuationsPine Script · Breakout · 1h