Calculating the RSI the Wilder way

Level: Intermediate 5 minutes · Last reviewed on Oct 13, 2026

For each candle, the change from the previous day counts: a plus as a gain, a minus as a loss. From the first 14 changes you form a simple average of each. Then comes : new avg. = (old avg. × 13 + today’s value) ÷ 14. RS is avg. gain divided by avg. loss, and RSI = 100 − 100 ÷ (1 + RS).

Why 13 and 14?

In Wilder’s smoothing, each new value counts one fourteenth. That corresponds to an EMA with k = 1 ÷ 14, not 2 ÷ 15. Programs that use a normal EMA or an SMA instead therefore show slightly different RSI values.

Edge cases

Exactly 100 only occurs if there was no loss since the calculation began; exactly 0 only without any gain. An earlier loss merely fades – per candle 13/14 of it stays in the avg. loss. If only gains follow a loss, the RSI approaches 100 but does not reach it. If nothing moves at all, it is undefined – our chart then shows 50. Early values also depend on the starting point.

Do the math (period 3)

Closes 10; 11; 10.50; 11.50; 12; 11. Changes +1; −0.50; +1; +0.50; −1. Start: avg. gain 2 ÷ 3 = 0.667, avg. loss 0.50 ÷ 3 = 0.167, RS 4, RSI 80. Then (+0.50): RSI 84.62. Then (−1): avg. gain and avg. loss 0.407 each, RS 1, RSI 50.

Try it Model numbers, not real prices

Things to try

  • Set the slider to the first candle with an RSI and read how the starting average is formed.
  • Go one candle further: how much does a single day change the avg. gain?
  • Find a candle with a loss: what happens to avg. gain and avg. loss at the same time?

Quick check

Show the RSI in your own chart → (with account)

↑ ↓ select · Enter open · Esc close