Home Finance Languages Travel RSS Feed
     You are in: Finance > Technical Analysis     See also: Exponential Moving Average, J. Welles Wilder Jr., Oscillators, RSI

How to Calculate RSI (Relative Strength Index)


This article is a detailed guide how to calculate the Relative Strength Index (RSI).

RSI formula

  • RSI = 100 – 100 / ( 1 + RS )
  • RS = Relative Strength = U / D
  • U = average of all up moves in the last N price bars
  • D = average of all down moves in the last N price bars
  • N = the period of RSI

Sum of all up moves and down moves

We’ll illustrate the calculation of RSI on the example of the most common period, 14. For RSI calculation you need closing prices of the last 14 days (for RSI with a period of 10, you need the last 10 closing prices etc.).

Let’s start with calculating the sum of all advances and declines in the last 14 days (or 14 price bars in general).

  • Take all days when the market closed higher than the previous day and calculate the increase in price units (not percent). It is simply the close today less close the day before. Ignore the days when market declined.
  • Sum up all the increases.
  • Now take all days when the market closed lower than the day before and calculate the decrease in price units in the same way as you did with increases. You need absolute (positive) values; therefore you take the previous day’s close less the close today. You ignore the up days now.
  • Sum up all the declines.

Now you have the first important input for the RSI formula, the sum of all increases and sum of all declines in the last N days (with N being the RSI period). The next step is to average them.

Averaging the advances and declines

At this moment, there are two different approaches commonly used.

  • J. Welles Wilder Jr., the inventor of RSI, calculated the indicator using exponential moving averages of advances and declines. The smoothing factor used in the EMA calculation equals the RSI period.
  • A more straightforward (and therefore also widely used) approach replaces the exponential moving averages with simple moving averages. You just divide both the sum of all increases and the sum of all declines by the RSI period (14 in our case) and you’re done.

Now you have the average up move (U) and average down move (D) in the last 14 price bars.

Calculating the Relative Strength

Relative Strength is defined as the ratio of average up moves and average down moves.

  • RS = U / D

Calculating the Relative Strength Index (RSI)

Finally, we know the Relative Strength and we can apply the RSI formula:

  • RSI = 100 – 100 / ( 1 + RS)

Lowest possible RSI value

What situation in the market would give us the lowest possible RSI value? A totally bearish market, of course. Imagine that every single day the market closed lower than the day before. There would be no up days. The sum of all advances would be zero and so would be the average advance. The average decline, on the other hand, would be some positive number (as you take absolute values when calculating the RSI). Relative Strength would be zero divided by something positive, which gives us zero. The RSI would be zero:

  • RSI = 100 – 100 / ( 1 + 0 ) = 100 – 100 = 0

Highest possible RSI value

What situation in the market would give us the maximum possible RSI value? This would be a totally bullish market with no down days. Average decline would equal zero and Relative Strength would be something positive divided by zero. Mathematically, you can’t calculate this – in this case the RSI value is defined as 100. If the average decline would be some very low number, but not zero, Relative Strength would be close to infinite and the RSI would be close to 100:

  • RSI = 100 – 100 / ( 1 + a big number ) = 100 – 0 = 100

To conclude, RSI can reach values between 0 (bearish market) and 100 (bullish market).



Related articles