16.02.2022 Advanced Topics

What is RSI and how it is calculated

what is RSI

What is RSI?

Developed by Welles Wilder, the Relative Strength Index (RSI) is a popular technical indicator commonly used due to its ease of usage and interpretation and the quality of the buying and selling signals it provides to investors and traders. The goal of RSI is to catch trend reversals by calculating the average change in the price movement of an asset over a range period and presenting it on a scale of 0 to 100 to determine whether it is oversold (undervalued) or overbought (overvalued)

How is the RSI calculated?

The RSI is a technical indicator that measures the momentum strength of an asset price by calculating the average change in its closing prices over a given time period.

Understanding the RSI formula

RS is the relative strength, and it is the essential component in the calculations (not to be confused with the relative strength index).

RS equals the average positive or up closes of price as they change from one day to the next over an X-day period divided by the average negative or down closes of price over the same number of X days. In other words:

RS = the average gains / the average losses, or alternatively :

RS= The EMA of gains/ The EMA of losses, where the EMA is the exponential moving average.

The formula of RS will become more understandable in next section.

RS in steps

The calculation of the relative strength undergoes three steps:

The first step is calculating the Exponential Moving Average (EMA) of gains and losses as the close of price changes over X days for the asset in question. The EMA places less significance or weight on earlier data than the most recent one.

The RSI uses 14 days as the default period, which is the value recommended by Welles Wilder. Traders are also known to use 5,7,9, 11, and even 50 day periods, but records show that 14 days is the more reliable.

To calculate the EMA of gains and losses, we first need to calculate their SMA or the simple moving average. To achieve this, we need to compute the positive and negative closes for each successive day (14 days period).

Gains:

If the previous daily price closed at $10, and today’s price closed at $11, then we have a $1 gain. So,

Positive or up close (gain) = today close – yesterday close

If today’s close is lower than the previous close (negative value), then the gain is recorded as 0.

Losses:

If the previous daily price closed at $11, and today’s price closed at $10, then we have a $1 loss. So,

Negative or down close (losses) = close yesterday – close today

If today’s close is higher than the previous daily price close (positive value), then the loss is recorded as 0.

After computing the gains and losses for each day, now we can calculate the simple moving average for the gain and loss for the entire period as follows:

SMA= sum of all gains over a 14-day period / 14 or,
SMA = X1 +X2…Xn / N

Then using the SMA, we can calculate the EMA for the average gains and losses using the following formula:

EMA n+1= alpha x Xn+1 + (1-alpha) x SMAn, where alpha is a multiplier which equals: 2/(n+1).

After that, we can move to the next step. The second step evolves calculating the RS:

RS= EMA of gains/ EMA of losses

The final step is calculating the RSI:

100 – [100/1+RS] or,
100 – {100/1+ (Average Gain/Average Loss)}

After figuring out the relative strength value, the rest of the formula components are straightforward. Their purpose is to make the final result bound to a constant range or scale of 0 to 100. They convert the relative strength to an index. Hence the name relative strength index

How to use the RSI indicator

The RSI is at equilibrium or neutral levels when its score is at 50 units. An RSI score below 30 units means that the asset is oversold, indicating it is probably time to buy. A score above 70 units, on the other hand, indicates overbought, signaling it is time to sell.

In either overextended score, the extreme values may indicate a change in price momentum and trend reversal. However, relying on the RSI and using oversold and overbought parameters alone may lead to unfavorable results. As a result, the trader should combine other technical indicators before initiating a trade.

Moreover, the RSI can stay overbought and oversold for quite some time. In bull markets, assets such as Bitcoin often stay in the overbought zone for an extended period, while in bear markets, the opposite is true. So in this case, the RSI could initiate a false signal.

If the price moves in a relatively tight range for a long period, the RSI will most likely be very neutral. Therefore, any subsequent impulsive movement will act as an outlier and push the indicator to one extreme. This could be a breakthrough that will lead to a continuation in price momentum or movement. So the RSI could also initiate a false signal in this case.

While the RSI is a reliable technical indicator, it sometimes initiates false signals. According to some studies, the RSI is more reliable in foreign exchange and futures markets than in the stock market.

RSI Divergence

An RSI divergence happens when the RSI moves or trends in the opposite direction of the price. A bullish RSI divergence means that the RSI is trending up on its chart while the price is trending down. This indicates that the selling pressure is lessening, and the price is more likely to reverse soon. 

Conversely, if the RSI is in a downtrend while the price is in an uptrend, it is a bearish RSI divergence. This would single a strong sign of the end of an uptrend.

Divergences usually occur at the end of a trend (bullish or bearish), especially at overbought or oversold levels. RSI trading signal becomes more reliable as the price reaches an extreme level. Setting overbought and oversold levels at 20 and 80 can improve the accuracy of the RSI. As the scale widens, the RSI initiates fewer trading signals.

Conclusion

The RSI determines the relative strength of an asset or a specific market, making this momentum oscillator an invaluable tool that can be used in almost any market. Numerous use cases for the RSI indicator allow traders to incorporate it into a variety of trading strategies and use it as a supporting indicator to back up their guess or conclusion.

References

  1. Moroșan, Adrian. (2011). The relative strength index revisited. African journal of business management. 5. 5855.
  2. John N. Ferris. (1998). Agricultural Prices and Commodity Market Analysis. Page 300
  3. Mark Etzkorn.(1997). Trading with Oscillators: Pinpointing Market Extremes — Theory and Practice, 1st edition. Wiley. Page 33

Join our free newsletter for daily crypto updates!