The RSI formula, derived
Derive the RSI formula from average gain and average loss using Wilder's smoothing.
Lesson path
Technical Analysis + Price Action
RSI Done Right
Pass the check before saving this lesson.
Pass the check to unlock nextOpen track mapChange starting pointToday's tiny win: make one idea click.
Derive the RSI formula from average gain and average loss using Wilder's smoothing.
What RSI is actually measuring
RSI stands for Relative Strength Index. J. Welles Wilder Jr. designed it in 1978, and the math has not changed since. Despite the name, RSI is not measuring one asset's strength against another. It is measuring an asset's recent up moves against its own recent down moves. That's it. The output is a single number between 0 and 100 that updates with every new candle close.
Here's the formula in plain steps. Step one: over the last 14 candles (the default period), separate every candle's price change into either a gain or a loss. An up candle contributes its close-minus-previous-close to the gain bucket. A down candle contributes the absolute value of its loss to the loss bucket. Step two: average each bucket. Step three: divide average gain by average loss. That ratio is called RS, or relative strength. Step four: feed RS into 100 minus 100 divided by 1 plus RS. The output is RSI.
There is one detail that trips up most beginners: Wilder used his own smoothing method, not a simple moving average. After the first 14 candles, each new average is calculated as ((13 times yesterday's average) plus today's value) divided by 14. This makes RSI smoother and slower than a plain rolling average would. Almost every charting platform uses Wilder smoothing by default. If yours has a setting called 'RMA' or 'Wilder', that is the original.
What does each end of the scale mean? RSI at 100 would require zero down candles in the lookback window, which almost never happens. RSI at 0 would mean zero up candles, equally rare. Most of the time RSI lives between roughly 20 and 80. The extremes are interesting precisely because they are rare. Now you know why the number behaves the way it does. The next nine lessons in this chapter use that foundation.
Recap: RSI = 100 - (100 / (1 + RS)), RS = average gain / average loss, default lookback 14, smoothed using Wilder's method.
Knowledge check
Answer before moving on.
1. What does the 'RS' in RSI actually represent?
2. After the first 14 candles, how is the average gain updated each new candle?
3. Why does RSI almost never touch 0 or 100?
Pass the check before saving.
Use the knowledge check first. After you pass it, this card turns into the save-and-continue handoff.