How the RSI Calculator works
The Relative Strength Index (RSI) is a momentum oscillator developed by J. Welles Wilder and published in his 1978 book New Concepts in Technical Trading Systems. It measures the speed and size of recent price changes on a scale of 0 to 100, comparing the average size of gains against the average size of losses over a chosen look-back period (14 bars by default). This calculator uses Wilder's own smoothing method — the same formula used in most charting platforms — rather than a plain simple average.
The formula
Wilder's RSI blends the prior period's average gain and loss with the latest period's move, weighted so that the older average carries (N−1) parts and the newest data point carries 1 part, where N is the RSI period:
Average Gain = (Previous Average Gain × (N−1) + Current Gain) / N
Average Loss = (Previous Average Loss × (N−1) + Current Loss) / N
From those smoothed averages, Relative Strength and RSI follow directly:
RS = Average Gain / Average Loss
RSI = 100 − (100 / (1 + RS))
Gains and losses are always entered as positive numbers — a losing period contributes to "loss," never a negative "gain." If a period closes higher than it opened (or higher than the prior close), its move counts as a gain and the loss for that period is zero, and vice versa.
Worked example
Suppose the previous average gain was 1.10 points and the previous average loss was 0.85 points over a 14-period RSI, and the latest period closed up 0.30 points (so current loss is 0). The smoothed average gain becomes (1.10 × 13 + 0.30) / 14 ≈ 1.0429, and the smoothed average loss becomes (0.85 × 13 + 0) / 14 ≈ 0.7893. Relative Strength is RS = 1.0429 / 0.7893 ≈ 1.3213, giving RSI = 100 − 100 / (1 + 1.3213) ≈ 56.9 — a neutral-to-firm reading, not yet overbought.
Why "previous" average gain and loss?
RSI is not recomputed from scratch each period; it is a smoothed moving average, so each new reading depends on the prior one. For the very first RSI calculation on a fresh dataset, the "previous" average gain and loss are simply the plain average of gains and average of losses over the first N periods — no smoothing yet. From the second calculation onward, every new average blends the previous smoothed average with the newest period's move using the weighting above. If you only have a single period of data, enter your first-N-period simple averages as the "previous" values and the next period's move as the current gain or loss.
Overbought, oversold, and their limits
Traders commonly treat RSI readings at or above 70 as overbought and at or below 30 as oversold, with 80/20 sometimes used as "extreme" thresholds. These levels describe how lopsided recent gains versus losses have been — they are not a prediction. In a strong, sustained uptrend RSI can stay above 70 for a long stretch, and in a strong downtrend it can stay below 30, so an overbought or oversold reading on its own is not a signal to act, only a description of recent momentum.
What moves the RSI reading most
- The size of the latest move relative to the recent average: because only 1 of the N weighting parts is "new," a single large move shifts RSI less than a string of consecutive moves in the same direction.
- The RSI period: a shorter period (e.g., 9) reacts faster and crosses 70/30 more often; a longer period (e.g., 21 or 25) is smoother and crosses those levels less often.
- An unbroken run of gains or losses: if average loss falls to zero (every recent period was an up period), RS is undefined and RSI caps at 100; if average gain falls to zero (every recent period was a down period), RSI caps at 0.