Technical Indicators · Illustrated reference
Relative Strength Index
From individual price changes to momentum, memory and divergence.
Animated explanation · synthetic observations
From a price change to an RSI reading
Bar 25: G = 0.8 × 0.8 + 1.0/5; L = 0.8 × 0.5 + 0.0/5. RSI 65.9.
Each change enters one side of the calculation. Existing gain and loss memories decay together; the new observation changes their balance. The complete reference is shown when motion is unavailable. Playback is optional.
In this reference
- A bounded comparison of gains and losses
- A price change travels through four transformations
- Build RSI from the changes, not from the price level
- How price changes enter the RSI calculation
- Same prices, two initialization conventions
- Reproduce calculations without a historical dataset
- Thresholds, regimes and divergence are different claims
- Divergence atlas: specify what is being paired
- What would make an RSI conclusion misleading?
- Why rescaling prices leaves RSI unchanged
- Sources and further study
A bounded comparison of gains and losses
The Relative Strength Index (RSI) compares smoothed positive and negative close-to-close changes in one price series and expresses that balance on a 0–100 scale. It does not compare the stock with an index; that is benchmark-relative performance, a different use of the words “relative strength.” RSI is not a valuation estimate, a probability or a forecast of the next return.
The useful question is not “Is 72 good or bad?” It is “What price changes, averaging rule and observation window produced 72, and what would that number actually support?” This chapter builds the calculation, exposes a real implementation difference, and tests the intuition that an extreme value must reverse.
A price change travels through four transformations
Four closes: 100, 102, 101, 104.
D: 0, 1, 0
Loss is a positive magnitude.
L = 1/3
Mean of three changes.
RSI = 83⅓
100 × G / (G + L).
The sign split is the first information transformation: a negative change becomes a positive loss magnitude, not a negative average. Smoothing is the second: recent changes enter a memory of older changes. The ratio is the third: gains are measured relative to losses. Normalization finally maps that balance onto 0–100.
For positive G and L, RS = G/L and RSI = 100 RS/(1+RS). RS values 1/3, 1 and 3 map to RSI 25, 50 and 75. Doubling RS does not double RSI: the mapping compresses extreme ratios. At G=L the reading is 50; when L approaches zero with G positive, the reading approaches 100.
Build RSI from the changes, not from the price level
Let Cₜ be the completed closing price at bar t. A gain is the positive part of its change; a loss is the magnitude of its negative part. A flat change contributes zero to both.
Uₜ = max(Δₜ, 0), Dₜ = max(−Δₜ, 0)
RSIₜ = 100 × Gₜ / (Gₜ + Lₜ)
G and L are smoothed gains and losses. For Wilder's n-period construction, initialize each with the arithmetic mean of the first n changes. Subsequent values use the recurrence below. The familiar expression 100 − 100/(1 + G/L) is equivalent when L is positive; the form above handles the one-sided cases more directly.
Lₙ = (D₁ + … + Dₙ) / n
Gₜ = ((n − 1)Gₜ₋₁ + Uₜ) / n
Lₜ = ((n − 1)Lₜ₋₁ + Dₜ) / n
You need n changes, hence n+1 closes, before this initialized value exists. With n=14, the first value follows 15 closes. It is not a 14-calendar-day measure unless those are the observations you actually supply. The educational workshop uses explicitly labelled synthetic observations.
A small calculation you can verify by hand
Use n=3 and closes 100, 102, 101, 104. Changes are +2, −1, +3. Initial G=(2+0+3)/3=5/3 and L=(0+1+0)/3=1/3. RSI=100×(5/3)/2=83.3333. If the next close is 102, the next gain is 0 and loss is 2. G becomes 10/9 and L becomes 8/9, so RSI becomes 55.5556. These are calculation results, not probabilities of rising.
If G>0 and L=0, RSI is 100. If G=0 and L>0, it is 0. If both are zero, the ratio is undefined mathematically. This chapter explicitly uses 50 as a neutral display convention for a flat series, matching the captured WOI chart convention. Missing warm-up values under Wilder initialization remain unavailable; they are not displayed as zero.
How price changes enter the RSI calculation
A single edited close changes two adjacent close-to-close differences. The optional laboratory links that observation across price, RSI and a numerical ledger; the formulas and illustrated sequence explain it without requiring any input.
Editable price paths and calculation ledger
An edited close changes the difference into it and out of it. Explore the eight labeled synthetic sequences or read the illustrated calculation above.
Magnitude and sequence
A +10 move contributes ten times the gain input of a +1 move. But its later influence depends on where it occurs in the history. Compare “Same finish / early rise” with “Same finish / late rise”: identical endpoint returns, different weighted gains and losses.
A subtle one-bar constraint
After initialization, a positive close-to-close change cannot lower correctly calculated Wilder RSI with unchanged inputs and parameters. Both averages retain the same decay factor; the new positive gain increases their ratio. A flat change preserves the ratio. A lower RSI at a higher price peak is possible across several bars that include intervening losses—not by every positive close individually lowering RSI.
For example, prior G=5 and L=1 give RSI 83.33. With n=5 and a new gain of 1, G falls to 4.2 while L falls to 0.8: RSI rises to 84. A falling gain average is not the same thing as a falling gain/loss ratio.
Animated explanation · synthetic observations
Inside RSI: the weighted memory of every change
Seed and every later change are included. The pieces sum exactly to the initialized Wilder averages; opacity distinguishes age, not confidence.
Each contribution is retained with a different age weight. Moving the pieces into two sums exposes the same G and L used by Wilder RSI. The complete reference is shown when motion is unavailable. Playback is optional.
Wilder smoothing has coefficient 1/n; it is not the conventional EMA coefficient 2/(n+1). For an existing contribution, the half-life in updates is ln(1/2)/ln(1−1/n), approximately 9.35 bars when n=14. This is a statement about the smoothed averages, not a guaranteed half-life for a particular RSI difference.
Same prices, two initialization conventions
Choose a period, step through the candles and compare the lines. The solid line uses the arithmetic-mean seed just described. The dashed line uses the existing WOI chart's first finite gain/loss seed followed by EWM with α=1/n. Those are different initial conditions, even though the later smoothing coefficient is the same.
At the same period and with the same subsequent observations, differences in the underlying smoothed averages decay by a factor (1−1/n) each step. The resulting RSI difference is nonlinear because it is a ratio. A longer warm-up often reduces seed differences, but a display beginning at the same visible candle need not use the same earlier history.
Reproduce calculations without a historical dataset
The optional price workshop exposes the synthetic closes and a numerical calculation ledger. Change the period or a close and compare the resulting gain/loss balance. The examples are constructed to isolate mechanisms, not selected market outcomes.
To compare an external implementation, align inputs, completed intervals, price adjustments, history length, seed and missing-value policy. A later observation must not change an earlier prefix calculation. This edition includes no historical provider dataset.
Thresholds, regimes and divergence are different claims
The familiar 70/30 levels are conventional reference thresholds. They do not follow from a theorem that markets reverse at those values. In a sustained rise, smoothed gains may dominate losses for a long time. In a decline, the reverse can persist. Shorter periods react more strongly to recent changes; they do not become more accurate merely because they react sooner.
A range-shift description says that the oscillator occupies a different part of its scale over a selected interval. To test that description as a predictor, define the interval, thresholds and prediction horizon in advance. Selecting them after viewing a profitable chart turns interpretation into outcome-conditioned selection.
Bearish divergence conventionally means a higher selected price high paired with a lower selected RSI high. Bullish divergence uses a lower price low and a higher RSI low. You still need a rule for pairing the turning points. If the turns require later confirmation, the divergence was not knowable at the first turning point. A slowing rise can produce divergence while price keeps rising; deceleration is not reversal.
RSI, a moving average and MACD all transform overlapping price observations. Their agreement is not automatically three independent pieces of evidence. A test of “confluence” must ask whether the extra transformation adds useful information beyond the first, after costs and selection effects.
Divergence atlas: specify what is being paired
Regular divergence compares price extending an extreme with a weaker paired oscillator extreme. Hidden divergence compares a price retracement that holds a higher low or lower high with a stronger oscillator retracement. Some literature discusses related geometry as positive or negative reversals. Terminology and pivot-pairing rules are not universal.
Regular bearish
Regular bullish
Hidden bullish
Hidden bearish
Failed bearish
These are computed synthetic examples, using Wilder RSI (5). Both panels use the same bar indices. For reproducibility, the RSI observation is sampled at each selected candle-price pivot; it is not required to be an independently confirmed RSI pivot. An analyst who pairs separate oscillator extrema may select different timestamps and obtain a different result. Do not silently switch conventions.
Regular is a disagreement, not a promise
A higher price high and lower RSI high can occur when the latest rise is less forceful than the previous one. A slowing rise can still continue. Further higher highs can invalidate a reversal hypothesis without invalidating the earlier geometric observation.
Hidden is not independent confirmation
A higher price low and lower RSI low compares a held price level with a more negative recent balance. Interpreting this as continuation is a convention to test, not an implication of the formula. The oscillator and price still share the same observations.
A divergence can fail without being miscalculated
The failed-divergence comparison extends the completed pivot pair with a later synthetic continuation. The price moves beyond both earlier highs despite the bearish disagreement. To study how often this occurs in markets, specify pivot pairing, confirmation delay, failure threshold, horizon and the entire eligible population before selecting cases.
Thresholds belong to context
A persistent rising path keeps losses at zero and RSI at 100 after initialization. A persistent falling path can remain at zero while the asset becomes still cheaper in price. Neither case provides valuation information. Range-shift descriptions such as different bullish/bearish RSI bands are conventional empirical hypotheses; selecting a band after seeing the trend is not validation.
What would make an RSI conclusion misleading?
- An incomplete candle: the current close can change, taking RSI with it. A reading above a level during the session may not remain there at the close.
- A data discontinuity: an unadjusted split or bad print can dominate the change series.
- A mismatched horizon: RSI 14 on hourly bars is not RSI 14 on daily bars, and averaging hourly RSI values does not produce daily RSI.
- A hindsight-selected example: showing only reversals after RSI 70 suppresses the cases where price continued rising.
- An undefined trade rule: an indicator event is not an entry, exit, execution assumption or complete risk model.
A defensible statement is narrow: “On these completed bars, with period 14 and this initialization, smoothed gains outweigh losses.” Moving from that observation to a decision requires independent context and an explicit uncertainty assessment.
Why rescaling prices leaves RSI unchanged
The transformation changes price units while preserving the gain/loss ratio under the same seed and period. Watch both smoothed amounts scale together. Reordering price changes is different: their weights change even if the final return does not.
Animated explanation · synthetic observations
Price scale changes. RSI does not.
The price axis changes with the transformation. Multiplication scales both G and L; translation changes neither. RSI is unchanged.
With consistent initialization, multiplying every price by a positive constant scales both gain and loss equally. Their ratio is unchanged. The complete reference is shown when motion is unavailable. Playback is optional.
For a positive multiplier a, every price change, smoothed gain and smoothed loss is multiplied by a. The common factor cancels in G/(G+L). Adding a fixed constant changes no price difference. Neither invariance identifies undervaluation. Changing only part of a split-adjusted history is not a consistent affine transformation.
Animated explanation · synthetic observations
Price and RSI slopes describe different things
Regular bearish. Second pivot known at bar 31; paired RSI is not required to be an independent RSI pivot.
The price extrema and paired RSI observations share timestamps. Opposing slopes are a description, not proof that price must reverse. The complete reference is shown when motion is unavailable. Playback is optional.
Sources and further study
- J. Welles Wilder Jr., New Concepts in Technical Trading Systems (1978), original RSI attribution. Formula and implementation references: TA-Lib RSI documentation.
- Lo, Mamaysky and Wang (2000), for the distinction between statistical information and a profitable trading strategy. It does not validate an RSI 70 rule or this lesson's examples.