0bps

Strategy vault / Machine learning

Fast RSI Strategy Analysis

This strategy utilizes the RSI indicator to determine price trends quickly. It has both long and short capabilities to capture faster short-term price levels.

Author
ChaoZhang
Complexity
Intermediate · 50 lines
Parameters
11
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

IMG

Strategy Name

Extreme Dual-Directional RSI Trend Strategy

Overview

This strategy utilizes the RSI indicator to determine price trends quickly. It has both long and short capabilities to capture faster short-term price levels.

Strategy Principle

The strategy uses an improved RSI indicator to judge the overbought and oversold status of prices, combined with candle body filtering to reduce noise. It goes long or short when the RSI is in the overbought or oversold zone and the candle body size is greater than 1/3 of the average body size. It closes positions when the candle reverses direction and the RSI pulls back to safer levels after the trading signals trigger.

Advantage Analysis

The strategy responds swiftly and can capture faster short-term trends. Meanwhile, the body filtering helps reduce noise and avoid being misled by false breakouts. It suits high volatility products well and can achieve higher returns.

Risk Analysis

The strategy is quite sensitive to price changes, easily misguided by false signals in the market. Also, stop losses may trigger frequently in the high volatility market. We can loosen the stop loss range and optimize RSI parameters to lower the false signal probability.

Optimization Directions

We can test different periodic parameters of the indicators to optimize the strategy and find the best parameter combination. Also, incorporating other indicators like the Turtle Trading rules may aid further in filtering signals. Training better RSI thresholds via machine learning methods could also be a worthwhile attempt.

Summary

Overall, this is an efficient and responsive short-term strategy. With some parameter and model optimization, it has the potential to further enhance stability and profitability. It merits continued research and tracking by quant traders.

Parameters

NameDefaultWhat it controls
v_input_1trueLong
v_input_2trueShort
v_input_37RSI Period
v_input_430RSI limit
v_input_5_close0RSI Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_62018From Year
v_input_72100To Year
v_input_8trueFrom Month
v_input_912To Month
v_input_10trueFrom day
v_input_1131To day

Source Pine Script

/*backtest
start: 2023-11-03 00:00:00
end: 2023-12-03 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy(title = "Noro's Fast RSI Strategy v1.1", shorttitle = "Fast RSI str 1.1", 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")
rsiperiod = input(7, defval = 7, minval = 2, maxval = 50, title = "RSI Period")
limit = input(30, defval = 30, minval = 1, maxval = 100, title = "RSI limit")
rsisrc = input(close, defval = close, title = "RSI Source")
fromyear = input(2018, defval = 2018, 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
fastup = rma(max(change(rsisrc), 0), rsiperiod)
fastdown = rma(-min(change(rsisrc), 0), rsiperiod)
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) / 3

//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-04. 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.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Fast-RSI-Strategy-Analysis.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. 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

esc

Try , , or .

↑↓ move↵ open