Improved RSI Scalping Strategy based on Relative Strength Index
The core idea of this strategy is to combine the RSI indicator and custom AI conditions to discover trading opportunities. It will establish long or short positions when multiple conditions are met, and use fixed…

Overview
The core idea of this strategy is to combine the RSI indicator and custom AI conditions to discover trading opportunities. It will establish long or short positions when multiple conditions are met, and use fixed take profit and stop loss levels.
Trading Logic
The strategy is implemented through the following steps:
- Calculate 14-period RSI values
- Define two custom AI conditions (long and short)
- Combine AI conditions with RSI overbought/oversold zones to generate entry signals
- Calculate position size based on risk percentage and stop loss pips
- Compute take profit and stop loss price
- Enter positions when entry signals are triggered
- Exit positions when take profit or stop loss is hit
Additionally, the strategy will generate alerts on signal creation and plot RSI values on the chart.
Advantage Analysis
The strategy has several key advantages:
- Combining RSI and AI conditions lead to more accurate trade signals
- Using multiple condition combinations effectively filters out false signals
- Position sizing based on risk management principles controls per trade risk
- Fixed take profit/stop loss provides clarity on risk and reward
- Highly customizable through parameter tuning
Risk Analysis
There are also some risks to consider:
- Incorrect RSI parameters may lead to inaccurate signals
- Poorly designed custom AI logic can generate false signals
- A stop loss level too tight may result in excessive stopping out
- Fixed take profit/stop loss may lose more profits or create more losses in volatile markets
These can be mitigated by tuning RSI parameters, optimizing AI logic, relaxing stop loss distances, etc.
Enhancement Opportunities
Some ways the strategy can be further improved:
- Incorporate more custom AI conditions to determine trend based on multiple factors
- Optimize RSI parameters to find best combinations
- Test different take profit/stop loss mechanisms like trailing stops or moving take profit
- Add additional filters like volume spikes to detect quality trading opportunities
- Employ machine learning to automatically generate optimal parameters
Summary
In summary, this is a highly configurable and optimizable advanced strategy for trading based on RSI and custom AI logic. It determines trend direction through a combination of multiple signal sources, executes trades with risk management and take profit/stop loss procedures. The strategy can provide good trading performance for users, with abundant expansion and optimization capabilities.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_int_1 | 14 | RSI Length |
| v_input_int_2 | 70 | RSI Overbought Threshold |
| v_input_int_3 | 30 | RSI Oversold Threshold |
| v_input_int_4 | 10 | Take Profit (Pips) |
| v_input_int_5 | 5 | Stop Loss (Pips) |
| v_input_float_1 | true | Risk Percentage |
Source Pine Script
/*backtest
start: 2022-12-28 00:00:00
end: 2024-01-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Improved RSI Scalping Strategy", overlay=true)
// Parameters
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Threshold")
rsiOversold = input.int(30, title="RSI Oversold Threshold")
takeProfitPips = input.int(10, title="Take Profit (Pips)")
stopLossPips = input.int(5, title="Stop Loss (Pips)")
riskPercentage = input.float(1, title="Risk Percentage", minval=0, maxval=100, step=0.1)
// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)
// Custom AI Conditions
aiCondition1Long = ta.crossover(rsiValue, 50)
aiCondition1Short = ta.crossunder(rsiValue, 50)
// Add more AI conditions here
var aiCondition2Long = ta.crossover(rsiValue, 30)
var aiCondition2Short = ta.crossunder(rsiValue, 70)
// Combine AI conditions with RSI
longCondition = aiCondition1Long or aiCondition2Long or ta.crossover(rsiValue, rsiOversold)
shortCondition = aiCondition1Short or aiCondition2Short or ta.crossunder(rsiValue, rsiOverbought)
// Calculate position size based on risk percentage
equity = strategy.equity
riskAmount = (equity * riskPercentage) / 100
positionSize = riskAmount / (stopLossPips * syminfo.mintick)
// Calculate Take Profit and Stop Loss levels
takeProfitLevel = close + takeProfitPips * syminfo.mintick
stopLossLevel = close - stopLossPips * syminfo.mintick
// Long entry
strategy.entry("Long Entry", strategy.long, when=longCondition[1] and not longCondition, qty=1)
strategy.exit("Take Profit/Stop Loss", from_entry="Long Entry", limit=takeProfitLevel, stop=stopLossLevel)
// Short entry
strategy.entry("Short Entry", strategy.short, when=shortCondition[1] and not shortCondition, qty=1)
strategy.exit("Take Profit/Stop Loss", from_entry="Short Entry", limit=takeProfitLevel, stop=stopLossLevel)
// Alerts
alertcondition(longCondition, title="Long Entry Signal", message="Long Entry Signal")
alertcondition(shortCondition, title="Short Entry Signal", message="Short Entry Signal")
// Plot RSI on the chart
plot(rsiValue, title="RSI", color=color.blue)
Published by ChaoZhang on the FMZ strategy square · last modified 2024-01-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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Improved-RSI-Scalping-Strategy-based-on-Relative-Strength-Index.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
- Dual Moving Average Crossover Scalping StrategyPine Script · Scalping · 1h
- Multi Timeframe Support Resistance Momentum Scalping Strategy with Volatility Adjusted Risk ManagementPine Script · Scalping · 1h
- 20Bitcoin and Gold 5 Minute Scalping Strategy 20Pine Script · Scalping · 1h
- Scalping EMA ADX RSI with Buy SellPine Script · Scalping · 5m
- Super ScalperPine Script · Scalping · 1m
- Advanced Multi Trend Confirmation EMA Supply Demand Zone Dynamic Scalping StrategyPine Script · Scalping · 1d