# RSI formula doubts

HI'm trying to understand how RSI calculation works. I've found here a nice and easy method and I recently also found this article, which states:

"RSI like many other oscillators is defaulted to a 14 period setting. This means the indicator looks back 14 bars on whatever graph you may be viewing, to create its reading. "

As I understand, the article suggest that the RSI is calculated based ONLY on the last 14 entries at any time interval and not from the beginning of history price, for which the formula offered by the tutorial does not work, suppose that price only grows for 14 time entries, then a division by 0 would occur.

Even more, the formula offered by the tutorial depends on every single close price from the beginning of history, which suggest me that every change recorded in the close price in the history has an impact onto the RSI value, and with more iterations come a better result of the RSI.

What I'm asking is how do you properly calculate the RSI of a, let's say 1 minute chart, because these two sources, seem to me, that they contradict each other.

RSI like many other oscillators is defaulted to a 14 period setting. This means the indicator looks back 14 bars on whatever graph you may be viewing, to create its reading.

" As I understand, the article suggest that the RSI is calculated based ONLY on the last 14 entries at any time interval and not from the beginning of history price, for which the formula offered by the tutorial does not work, suppose that price only grows for 14 time entries, then a division by 0 would occur."

Problem #1 is that the article says all 14 periods (minutes, days, etc.) but then uses Wilder's Smoothing method which doesn't use 14 days (see below).

So the first two paragraphs are correct if the Simple Moving Average method is used but otherwise, no. As stated in your link:

First Average Gain = Sum of Gains over the past 14 periods / 14.

First Average Loss = Sum of Losses over the past 14 periods / 14

These first two calculations are an average of all price changes that occurred with within the first 14 days. Some will be positive. Some will be negative and it's possible that some will be zero if the underlying is unchanged. You'll have a total 14 entries in two columns. IOW, 0 to 14 entries in one column and 14 minus that number in the other (see their attached spreadsheet when you click CALCULATIONS under OUTLINE).

Once those initial numbers are calculated, everything thereafter uses exponential moving averages (or Wilder's Smoothing) so you're only looking at the RS value from the previous day plus the new day's value (not the previous 14 days).

The problem that you have run into is that there are 3 methods used to to calculate the averages:

• Simple Moving Average
• Exponential Moving Average
• Wilder’s Smoothing Method

The correct way is to use an exponential moving average but the spreadsheet in your link uses Wilder's Smoothing method which is a smoothing constant of 13:1 to mimic an exponential moving average.

Average Gain = [(previous Average Gain) x 13 + current Gain] / 14.

Average Loss = [(previous Average Loss) x 13 + current Loss] / 14.

As per their explanation:

Taking the prior value plus the current value is a smoothing technique ** SIMILAR ** to that used in calculating an exponential moving average.

The formula for an EMA is 2/(n+1) as the smoothing constant which in this case would be 2/15 (14 days). You can find this at the same web site or you can Google it.

The article got close but no cigar.

• Oh, thank you very much, nice introductory explanation! – Vlad Potra Mar 14 '18 at 12:25