The Relative Strength Index (RSI) was created by J Welles Wilder in the late 1970s. This is a technical indicator that shows the strength of the price of an instrument relative to its past history. It should not be confused with “Relative Strength” where an instrument is compared to another instrument or index.

The calculation of RSI uses a series of single prices for an instrument such as the days closing price of a share. It is an oscillator which means that the range of values it can take are bounded by zero and 100 unlike moving averages. In a similar to the momentum indicator, it uses the change in prices to calculate the value, however it is a more complicated calculation than the straight momentum indicator because it takes account of up days and down days.

After series of larger up days than down days the RSI rises and it can as a maximum peak at 100. Similarly after a series of larger down days the RSI will fall and can reach a minimum of zero.

The period which Welles Wilder used was a 14 day period which has become a standard figure for the RSI, however it can be used over any period.

The calculation of the RSI is as follows:

To calculate the first value of RSI the following calculation is performed:

Assuming a 14 day period of closing prices P1, P2 to P14.with P14 being the oldest and P1 being todays price

Calculate the change in price for each day:

D1= P1  – P2

D2 = P2 – P3

Etc to .D13

We then sum all the up days:

Total_up= Sum of all D values above zero

We then sum all the Down days:

Total_Down= Sum of all D values below zero

Note the Total Down will be a positive number or zero

We then divide the Total_ups by the Total_Downs

RS=Total_up/Total_down

Note that if the Total_down is zero this calculation will crash when done on a computer, so when programming this in EXCEL or anything else this must be tested for.

## Relative Strength Index formula

The Relative Strength Index is calculated from the following formula

RSI=100-(100/[1+RS])

For every subsequent day the calculation of RSI uses only todays change in price and yesterdays  values of Total_ups and Total_downs. In the days before computers were on every desk the calculation was done by hand, this method made updating the RSI values for a lot of stocks much faster.

For subsequent days the calculation is as follows:

Calculate the change in price for today compared to yesterday:

Dtoday= Ptoday  – Pyesterday

Assume that KP is the period of the RSI, which in our example is 14 days

Then      K1= (KP-1)/KP  (i.e 13/14 in our example)

K2 = 1/KP    (i.e 1/14 in our example)

If Dtoday  is positive then

Total_upstoday = K1 * Total_upsyesterday + K2 * Dtoday

Total_Downstoday = K1 * Total_Downsyesterday

If Dtoday  is Negative then

Total_Downstoday = K1 * Total_Downsyesterday + K2 * Dtoday

Total_upstoday = K1 * Total_upsyesterday

Then the calculation of the RSI is as before:

RS=Total_up/Total_down

RSI=100-(100/[1+RS])

This method of calculating the RSI from the previous value effectively smoothes the values of the RSI in a similar way to an exponential moving average, however the Welles Wilder 14 day calculation is equivalent to an exponential smoothing of 27 days.

It is interesting to compare the different values you get for RSI from a series of prices that start and finish at the same value.  Note that the 14 day momentum value for these two stocks would be the same.

Let us compare the following series of 14 prices:

Stocks A Price Stock A Delta Stocks B Price Stock B Delta
P1 13 13
P2 12 -1 9 -4
P3 14 2 15 6
P4 16 2 10 -5
P5 18 2 16 6
P6 20 2 14 -2
P7 22 2 20 6
P8 24 2 18 -2
P9 26 2 24 6
P10 28 2 22 -2
P11 30 2 28 6
P12 32 2 26 -2
P13 34 2 32 6
P14 36 2 36 4
Total Downs 1 17
Total Ups 24 40
RS 24 2.35294118
1+rs 25 3.35294118
100/(1+rs) 4 29.8245614
RSI 96 70.1754386

## Usage of RSI

The conventional way of explaining what RSI shows is to say that the instrument is overbought when the  RSI is greater than 70, and the instrument is oversold when the RSI is less than 30. However things are never that simple and RSI shows far more than this and can be used in many ways. It has traditionally been one of the favourite indicators amongst traders and investors and can be used in swing trading and in trend following.

Research has shown that selling a stock when the the RSI goes above 70 or buying when it goes below 30 does not generate certain winners.

When a stock or any instrument is trending for any reasonable length of time, the RSI will sit consistently in the overbought or oversold ranges, so there is some argument for buying the instrument when the RSI goes above 70.  Thus some people use the transition from greater than 70 to less than 70 as a signal that a trend is nearing the end and thus could be a time to exit a long trade or go short. Similarly it can be used for closing shorts or going long when RSI goes from less than 30 to greater than 30.

The RSI can be used in swing trading in combination with support and resistance for example if an instrument is approaching resistance, the RSI is over 70 and is turning down this could be the trigger to enter short. Similarly if the price is approaching support and the RSI is less than 30 and turning up then it could trigger a long entry.

Another way that RSI can be used is as an indicator showing divergence with the price action. Thus if an instrument is trending upwards and is showing a series of higher highs but the RSI plot is showing a series of peaks with lower highs i.e. is showing divergence from the price action, this is a good indicator that the trend is coming to an end and thus it is time to close a long position and think about going short. See fig.1 below. Again this is reversed for a downward trend

fig.1 Click Image to see larger version

Some people use the absolute value of RSI as an indicator as to whether an instrument is in a bull or bear mode, i.e if RSI is over 50 it is in bull mode if it is less than 50 it is in bear mode.

As with all indicators it cannot be used reliably on its own and must be used in conjunction with other signals to confirm a position. Remember that it is derived from only one daily price which is the closing price , and so should not be used with other indicators that are derived from just that price, since they will more or less inevitably confirm each other.

## Relative Strength Index (RSI) – Courtesy of offthelip

Offthelip graduated from Oxford University with a Degree in Engineering Science, then trained and qualified as a Chartered Electrical Engineer. Worked in electronics design and then software design for many well known companies, e.g. IBM, BT, BAE, General Motors, Thales, ending up as Chief Systems Engineer on a hundred million pound project. More than 40 years experience in using computers, an expert in many types of software, Microsoft Excel being the most well known.

If you would like to contact offthelip regarding RSI then please feel free to e-mail Harry who will get in touch with him for you