Strategy vault / Mean reversion
Relative Strength Index strategy
This script is written in Pine Script for TradingView platform and implements a simple RSI (Relative Strength Index) strategy for trading the Litecoin (LTC) to USDT pair on Binance exchange using a 5-minute chart…
This script is written in Pine Script for TradingView platform and implements a simple RSI (Relative Strength Index) strategy for trading the Litecoin (LTC) to USDT pair on Binance exchange using a 5-minute chart.
Here's a brief explanation of this strategy:
Parameters:
- RSI Length: 3, which means it calculates the RSI based on the last 3 periods.
- RSI OverSold level: 47, which means it considers the market oversold (a potential buying opportunity) when the RSI falls below 47.
- RSI OverBought Level: 56, which means it considers the market overbought (a potential selling opportunity) when the RSI rises above 56.
Operations:
- If the RSI crosses over the oversold level, the strategy enters a long position (buys).
- If the RSI crosses under the overbought level, the strategy enters a short position (sells).
This particular backtest has resulted in a profit of 391%, executed over 2400 trades, with a 42% profitability rate, a 14.6% drawdown, and a Sharpe ratio of 0.65.
However, it's important to remember that past performance doesn't guarantee future results. Also, the author suggests that additional filters can be added to this strategy to improve its performance.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 3 | length |
| v_input_2 | 47 | overSold |
| v_input_3 | 56 | overBought |
Source Pine Script
/*backtest
start: 2022-09-01 00:00:00
end: 2023-08-14 05:20:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("QuantNomad - RSI Strategy - LTCUSDT - 5m", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
length = input(3)
overSold = input(47)
overBought = input(56)
price = close
//
// author: QuantNomad
// date: 2019-06-06
// RSI Strategy - LTCUSDT - 5m
// https://www.tradingview.com/u/QuantNomad/
// https://t.me/quantnomad
//
vrsi = rsi(price, length)
if (not na(vrsi))
if (crossover(vrsi, overSold))
strategy.entry("RsiLE", strategy.long, comment="RsiLE")
if (crossunder(vrsi, overBought))
strategy.entry("RsiSE", strategy.short, comment="RsiSE")
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-08. 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/Relative-Strength-Index-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