PQ ProvectusQuantus
Technical Analysis · · 7 min read

RSI Explained: The Complete Guide for Algorithmic Traders

Everything you need to know about the Relative Strength Index — the math, the signals, the traps. Learn how RSI really works, when to trust it, and how to build it into strategies that hold up in backtesting.

RSI oscillator chart with overbought and oversold zones annotated

TL;DR

  • RSI (Relative Strength Index) measures the speed and magnitude of recent price changes on a scale of 0–100.
  • Above 70 is traditionally considered overbought. Below 30 is oversold. But these aren’t automatic buy/sell signals.
  • RSI was invented by J. Welles Wilder Jr. in 1978. The standard lookback period is 14.
  • The three main RSI strategies are overbought/oversold reversals, divergence, and failure swings — each with different tradeoffs.
  • RSI works best combined with a trend filter. In a strong uptrend, RSI can stay above 70 for weeks. Don’t fight the trend.

The Relative Strength Index is probably the most widely used momentum oscillator in trading. It appears in almost every charting platform, every trading course, and every technical analysis textbook. If you’ve ever seen a number between 0 and 100 below a price chart, it was probably RSI.

But most traders use RSI wrong. They buy the moment it touches 30 and sell when it hits 70, and then wonder why they keep getting stopped out in trending markets. RSI is more nuanced than that — and once you understand the math and the edge cases, it becomes a genuinely useful tool.

What RSI Measures

RSI quantifies momentum — how fast price is moving, and in which direction. It answers: over the last N bars, how much of the total price movement was upward vs. downward?

  • An RSI of 70 means roughly 70% of recent price movement has been upward.
  • An RSI of 30 means roughly 70% has been downward.
  • An RSI of 50 means up and down moves have been roughly equal.

The value is bounded between 0 and 100, making it easy to compare across different assets and timeframes.

The Math

RSI is calculated in two steps. First, compute the Relative Strength (RS) — the ratio of average gains to average losses over the lookback period. Then normalize it into the 0–100 range.

RS  =  Average Gain  /  Average Loss

RSI  =  100 − 100 / ( 1 + RS )

Wilder’s Smoothing

The averages aren’t simple arithmetic means. Wilder used a specific exponential smoothing method:

First Average Gain  =  Sum of Gains over 14 periods / 14

Subsequent  =  ( Previous Avg × 13  +  Current Gain )  /  14

This is essentially an exponential moving average with a smoothing factor of 1/14 (rather than the standard EMA’s 2/15). The effect: Wilder’s smoothing is slower and more stable than a regular EMA, which makes RSI less jittery. It also means RSI values depend on how much history you feed it — 250 bars will produce slightly different results than 50 bars, even though both use a 14-period lookback.

The same formula applies to Average Loss. On days when price goes up, the loss for that day is zero (and vice versa).

Reading RSI: The Three Zones

RSI chart showing overbought zone above 70, oversold zone below 30, and neutral range between
The three zones of RSI. Overbought and oversold are starting points for analysis, not automatic signals.

Overbought (Above 70)

When RSI crosses above 70, price has been rising aggressively. The textbook says “sell.” The reality is more nuanced:

  • In a strong uptrend, RSI can stay above 70 for weeks or months. Selling every time RSI hits 70 in a bull market is a losing strategy.
  • Overbought means extended, not doomed. It’s a warning to pay attention, not to hit the sell button.
  • The signal improves dramatically when combined with other evidence: resistance levels, bearish candlestick patterns, or volume divergence.

Oversold (Below 30)

The mirror image. RSI below 30 means selling pressure has been dominant. But:

  • In a bear market or downtrend, RSI can camp below 30 while price continues falling. Buying every dip in a collapse is how accounts blow up.
  • Oversold is an opportunity only in context. If the broader trend is up and RSI briefly dips below 30, that’s a much more reliable buy signal than the same reading in a freefall.

The Neutral Zone (30–70)

Most of the time, RSI lives between 30 and 70. This range isn’t signaling anything dramatic — momentum is within normal bounds. Some traders adjust the thresholds: 80/20 for trending markets, 60/40 for range-bound markets. The “right” levels depend entirely on the asset and timeframe.

Divergence: The Early Warning System

Divergence occurs when price and RSI disagree about direction. It’s one of the most powerful — and most misused — RSI signals.

Side-by-side diagrams showing bullish divergence (price lower low, RSI higher low) and bearish divergence (price higher high, RSI lower high)
When price says one thing and RSI says another, someone is lying. RSI is usually right — eventually.

Bullish Divergence

Price makes a lower low, but RSI makes a higher low. Translation: price is still falling, but the selling momentum is weakening. Each push lower has less force behind it. This often precedes a reversal upward.

Bearish Divergence

Price makes a higher high, but RSI makes a lower high. Translation: price is still rising, but each rally has less momentum. The buyers are losing conviction. This often precedes a pullback.

The Trap

Here’s what every divergence tutorial leaves out: divergence can persist through multiple swings before a reversal actually happens. In a strong trend, you might see three or four bearish divergences before the top finally arrives. Each one looks like a sell signal, and each one would stop you out.

The fix: never trade divergence alone. Use it as a heads-up, not a trigger. Wait for confirmation — a break of support/resistance, a candlestick reversal pattern, or a failure swing (below).

Failure Swings: Wilder’s Best-Kept Secret

Most traders never learn about failure swings, but Wilder himself considered them his strongest RSI signal. Unlike divergence, failure swings look only at RSI — they don’t require any price confirmation.

Diagram showing bullish and bearish failure swing patterns on RSI with labeled points A, B, C, D
Failure swings are RSI-only patterns. A enters the extreme zone, B exits, C retests but fails to re-enter, D confirms the reversal.

Bullish Failure Swing

  1. RSI drops below 30 (point A — oversold)
  2. RSI bounces back above 30 (point B)
  3. RSI pulls back but stays above 30 (point C — higher low)
  4. RSI breaks above B’s level (point D — buy signal)

The key: at point C, RSI tried to go back to oversold territory and failed. The sellers couldn’t push it back down. When RSI then breaks above B, the reversal is confirmed.

Bearish Failure Swing

The mirror: RSI goes above 70, drops below, bounces but stays below 70, then breaks below the prior low. That’s the sell signal.

Why Failure Swings Work

Failure swings are essentially support/resistance analysis applied to RSI itself. They’re mechanical, unambiguous, and don’t require subjective price analysis. The tradeoff: they’re rare. You might wait weeks for a clean failure swing setup.

Choosing an RSI Strategy

Three-card comparison of RSI strategies: Overbought/Oversold, Divergence, and Failure Swings
Each RSI strategy has a different risk profile. Match the approach to your trading style and market conditions.
StrategySignal SpeedFalse Signal RateBest Market
Overbought/OversoldFastHigh in trendsRanging, sideways
DivergenceMediumMedium (can persist)Late-trend reversals
Failure SwingsSlowLowAny (rare but reliable)

The hybrid approach that works best in backtesting: use RSI overbought/oversold for entry timing, but only in the direction of the larger trend. If the 200 SMA says “up,” only take RSI oversold signals (buys). If the 200 SMA says “down,” only take overbought signals (sells). This single filter eliminates most of the false signals that make naive RSI strategies unprofitable.

RSI Period: Does 14 Actually Matter?

Wilder chose 14 because he was working with half a lunar cycle (seriously — he was into cycles). But the period does affect behavior:

  • Shorter periods (5–9): More sensitive, more signals, more noise. Good for scalping and very short-term trading.
  • Standard (14): The default that everyone uses. Works well on daily bars for swing trading.
  • Longer periods (21–50): Smoother, fewer signals, but each one carries more weight. Good for position trading and trend following.

Like moving average periods, if your strategy breaks when you change the RSI period by ±2, the edge is probably noise. Robust strategies work across a range of similar parameters.

Implementation Notes

Warmup period. RSI needs at least N bars of data, but because of the exponential smoothing, values stabilize better with about 3× the period. For RSI(14), feed at least 42 bars before trusting the output.

Use adjusted close prices. Dividends and splits create phantom RSI signals. Always compute RSI on split-adjusted, dividend-adjusted closing prices.

RSI on different timeframes. RSI(14) on a 5-minute chart is a very different signal than RSI(14) on a daily chart. The daily version captures weeks of momentum. The 5-minute version captures about an hour. Context matters.

Don’t combine too many indicators. RSI, MACD, and Stochastic all measure momentum. Using all three gives you the same signal three times, not three signals. Combine RSI with something different — price structure, volume, or a trend filter like SMA.

The Honest Truth About RSI

RSI is a lagging indicator derived from price. It cannot predict anything that isn’t already contained in the price data. What it does is reframe price action into a bounded, normalized scale that makes it easier to spot momentum extremes and shifts.

The value of RSI isn’t in the indicator itself. It’s in the discipline it imposes: don’t buy into extreme strength without caution, don’t sell into extreme weakness without evidence, and pay attention when price and momentum diverge.

The traders who profit from RSI aren’t the ones who follow it blindly. They’re the ones who understand when it works, when it doesn’t, and what to do about both.

Ready to test RSI strategies without writing code? ProvectusQuantus lets you describe RSI-based strategies in plain English, backtest them against real historical data, and see exactly how different parameters and thresholds perform.

References

Build and Backtest with Confidence

ProvectusQuantus lets you describe strategies in plain English, backtest against real data, and deploy — no code required.

More Insights

Technical Analysis

SMA vs EMA: Moving Averages Explained for Algorithmic Traders

A visual, practical guide to the two most important moving averages in trading. Learn exactly how SMA and EMA differ, when each one wins, and how to combine them into real strategies you can backtest.

Read article
Algorithmic Trading

Essential Algorithmic Trading Strategies for 2024

Explore the most effective algorithmic trading strategies, from momentum to stat arb, and see how modern quants structure signals, risk, and execution.

Read article