RSI Calculator (Relative Strength Index)
Calculate Relative Strength Index from average gains and losses.
Includes overbought (70+) and oversold (30-) zones for momentum trading signals.
Welles Wilder published RSI in 1978. It is still the most-used oscillator on retail charts almost 50 years later. The formula:
RSI = 100 - (100 / (1 + RS))
where RS (Relative Strength) is the average gain divided by the average loss over the lookback period. Default lookback is 14 bars. Some swing traders use 9, intraday scalpers go down to 5, and longer-term traders push to 21 or 25.
The two-step calculation. First period uses simple averages of gains and losses. Every period after that uses Wilder’s smoothing — the running average is updated as ((prev_avg × (N-1)) + current) / N. Wilder’s smoothing weights recent data less aggressively than an EMA, which is why RSI tends to read more smoothly than a stochastic on the same data.
Reading the value.
- Above 70: overbought, pullback risk rising
- Below 30: oversold, bounce odds increasing
- Crossing 50: trend bias flipping
- Above 80 or below 20: extreme zones, common during strong trends
The classic mistake. Treating RSI > 70 as an automatic short signal. In a strong uptrend, RSI lives between 60 and 90 for weeks. Selling every 70 print burns capital. Better: use RSI for divergences (price making higher highs while RSI makes lower highs) or for confirmation alongside structure.
Worked example. Over 14 bars: total gains 12.6, total losses 4.2.
- Avg gain = 0.9, avg loss = 0.3
- RS = 0.9 / 0.3 = 3.0
- RSI = 100 - (100 / 4) = 75
That is solidly overbought. In a ranging market, expect a pullback. In a strong trend, expect another leg up.