RSI - Relative Strength Index

How to calculate RSI of Nifty in excel spreadsheet visit -


Developed by J. Welles Wilder and introduced in his 1978 book, New Concepts in Technical Trading Systems, the Relative Strength Index (RSI) is an extremely useful and popular momentum oscillator. The RSI compares the magnitude of a stock's recent gains to the magnitude of its recent losses and turns that information into a number that ranges from 0 to 100. It takes a single parameter, the number of time periods to use in the calculation. In his book, Wilder recommends using 14 periods.

The RSI's full name is actually rather unfortunate as it is easily confused with other forms of Relative Strength analysis such as John Murphy's "Relative Strength" charts and IBD's "Relative Strength" rankings. Most other kinds of "Relative Strength" stuff involve using more than one stock in the calculation. Like most true indicators, the RSI only needs one stock to be computed. In order to avoid confusion, many people avoid using the RSI's full name and just call it "the RSI."


    RSI = 100 - --------
                 1 + RS

    RS = Average Gain / Average Loss

    Average Gain = [(previous Average Gain) x 13 + current Gain] / 14
    First Average Gain = Total of Gains during past 14 periods / 14

    Average Loss = [(previous Average Loss) x 13 + current Loss] / 14
    First Average Loss = Total of Losses during past 14 periods / 14 

    Note: "Losses" are reported as positive values.

To simplify our explanation of the formula, the RSI has been broken down into its basic components which are the RSthe Average Gain, and the Average Loss.

To calculate RSI values for a given dataset, first find the magnitude of all gains and losses for the 14 periods prior to the time where you wish to start the calculation. (Note: 14 is the standard number of periods used when calculating the RSI. If a different number is specified, just substitute that number in for "14" throughout this discussion.)

It is important to understand that the RSI is a "running" calculation and the accuracy of the calculation depends on how long ago the calculations started. The first RSI value is an estimate - subsequent values improve on that estimate. You should calculate at least 14 values prior to the start of any values that you will rely on - going back 28+ periods is even better.

To start the running calculation, the First Average Gain is calculated as the total of all gains during the past 14 periods divided by 14. Similarly, the First Average Loss is calculated as the total magnitude of all losses during the past 14 periods divided by 14. The next values for the "averages" are calculated by taking the previous value, multiplying it by 13, adding in the next Gain (or Loss), and then dividing by 14. This is Wilder's modified "smoothing" technique in action.

The RS value is simply the Average Gain divided by the Average Loss for each period.

Finally, the RSI is simply the RS converted into an oscillator that goes between zero and 100 using this formula: 100 - (100 / RS + 1).

Here's an Excel Spreadsheet that shows RSI calculation in action.

When the Average Gain is greater than the Average Loss, the RSI rises because RS will be greater than 1. Conversely, when the Average Loss is greater than the Average Gain, the RSI declines because RS will be less than 1. The last part of the formula ensures that the indicator oscillates between 0 and 100. Note: If the Average Loss ever becomes zero, RSI becomes 100 by definition.


Important Note: The more data points that are used to calculate the RSI, the more accurate the results. The smoothing factor is a continuous calculation that - in theory - takes into account all of the closing values in the data set. If you start an RSI calculation in the middle of an existing data set, your values will only approximate the true RSI value. SharpCharts uses at least 250 data points prior to the starting date of any chart (assuming that much data exists) when calculating its RSI values. To duplicate our RSI numbers, you'll need to use at least that much data also.



Wilder recommended using 70 and 30 and overbought and oversold levels respectively. Generally, if the RSI rises above 30 it is considered bullish for the underlying stock. Conversely, if the RSI falls below 70, it is a bearish signal. Some traders identify the long-term trend and then use extreme readings for entry points. If the long-term trend is bullish, then oversold readings could mark potential entry points.


Buy and sell signals can also be generated by looking for positive and negative divergences between the RSI and the underlying stock. For example, consider a falling stock whose RSI rises from a low point of (for example) 15 back up to say, 55. Because of how the RSI is constructed, the underlying stock will often reverse its direction soon after such a divergence. As in that example, divergences that occur after an overbought or oversold reading usually provide more reliable signals.

Centerline Crossover

The centerline for RSI is 50. Readings above and below can give the indicator a bullish or bearish tilt. On the whole, a reading above 50 indicates that average gains are higher than average losses and a reading below 50 indicates that losses are winning the battle. Some traders look for a move above 50 to confirm bullish signals or a move below 50 to confirm bearish signals.


Dell Inc. (DELL) RSI example chart from

The DELL example shows a number of extreme readings as well as a negative divergence. In Oct-99, RSI reached oversold for a brief moment to mark the low around 38. The next extreme reading (overbought) occurred after a large advance that peaked in Dec-99. RSI reached overbought levels in late Dec-99 and moved below 50 by the second week of Jan-00. The next oversold reading occurred in Feb. for another brief moment and marked the low around 35. By the end of Feb-00, RSI moved back above 50 and into overbought territory in March. A negative divergence formed in March and marked the high in the upper fifties.

Calculate RSI for Nifty of any stock or index -