RSI (Relative Strength Index): Overbought, Oversold and How Bots Use It
How the Relative Strength Index is calculated, why 70/30 is not a sell/buy signal by itself, and practical RSI rules for mean-reversion and trend-following trading bots.
The Relative Strength Index (RSI) is one of the most popular momentum oscillators. It compresses recent price changes into a number between 0 and 100. Traders know the classic levels - above 70 “overbought”, below 30 “oversold” - but using those levels mechanically is a common way to lose money. In a trading bot, RSI works best with a clear purpose and a filter for market regime.
How RSI is calculated
J. Welles Wilder introduced RSI in 1978. Over n periods (classically 14):
- Separate each period’s price change into gains and losses.
- Compute the smoothed average gain and average loss (Wilder smoothing).
RS = average gain / average lossRSI = 100 − 100 / (1 + RS)
If all recent changes are gains, RSI approaches 100; if all are losses, it approaches 0.
How to read RSI
- Level - where momentum stands now.
- Extremes - 70/30 classically; 80/20 or 90/10 for stricter signals.
- Centre line 50 - above 50 gains dominate, below 50 losses dominate.
- Divergence - price and RSI disagree about new highs or lows.
- Ranges shift in trends - in uptrends RSI often oscillates between about 40 and 80; in downtrends between 20 and 60.
Two opposite ways bots use RSI
Mean reversion
In ranging markets, extremes tend to revert:
- Buy when RSI(2-5) falls below 10-20 and price is above a long moving average (trade pullbacks within an uptrend).
- Exit when RSI rises back above 50-70, or after a fixed number of bars.
The trend filter matters: buying every oversold reading in a downtrend is how mean-reversion systems blow up.
Momentum / trend following
In trends, strength persists:
- Trade only longs while RSI(14) stays above 50 (or a trend filter agrees).
- Enter on pullbacks where RSI dips toward 40-50 and turns up.
- Treat readings above 70 as confirmation of strength, not as a sell signal.
Choosing the mode: regime filters
The same RSI reading means different things in different regimes. Combine RSI with:
- ADX - low ADX favours mean reversion; high ADX favours trend following. See ADX.
- Moving averages - trade in the direction of a 100-200 period average.
- Volatility - skip signals during news spikes.
A worked example
EURUSD H1, mean-reversion bot:
- Filter: close above EMA(200).
- Entry: RSI(3) closes below 15 → buy at next bar open.
- Exit: RSI(3) closes above 60, or after 10 bars.
- Stop: 1.5 × ATR(14).
The bot buys short-term dips in an uptrend and exits quickly. Typical profile: high win rate, small average win, occasional larger losses - so the stop and position size matter more than the entry.
Pitfalls
- Selling strength in trends. RSI above 70 in a strong trend often means “more to come”.
- Too many thresholds. RSI period, upper level, lower level, exit level: four parameters fit noise quickly. Keep the period fixed and test levels on a coarse grid.
- Repainting on the open bar. Use values from the closed bar.
- Ignoring costs. Short-term RSI strategies trade often; spread and commission decide whether the edge survives.
Key takeaways
- RSI measures the balance of recent gains and losses on a 0-100 scale.
- Overbought and oversold are context, not signals by themselves.
- Use short RSI for mean reversion with a trend filter; use RSI above/below 50 for trend following.
- Decide the regime first, then the RSI rule.
FAQ
Is RSI above 70 a sell signal?
Not on its own. In strong uptrends RSI can stay above 70 for long periods while price keeps rising. Overbought readings work better as mean-reversion signals in ranges, or as a filter combined with trend and price structure.
What is the best RSI period?
14 is the classic default. Short periods such as 2-5 are popular for short-term mean reversion because they reach extremes often; longer periods are smoother and better as trend filters.
What is RSI divergence?
Price makes a new high while RSI makes a lower high (or the reverse for lows). It shows fading momentum, but divergences can persist through long trends, so they need confirmation.
Sources and further reading
- StockCharts ChartSchool: Relative Strength Index (RSI) - chartschool.stockcharts.com
- StockCharts ChartSchool: Average Directional Index (ADX) - chartschool.stockcharts.com