The Relative Strength Index (RSI) indicator, as the name suggests, tells us the relative strength of the asset. RSI is counted as a robust technical indicator.
RSI calculation with the help of an example
Let’s understand how to calculate and graph the RSI indicator. While you can easily calculate the RSI indicator value with the Python code, for explanation purposes we will do it manually.
Step 1: Closing Price
We will take the closing price of the stock for 30 days. The closing price is mentioned in column (1).
Step 2: Changes in Closing Price
We then compare the closing price of the current day with the previous day’s closing price and note them down. Thus, from the table, for 25-04, we get the change in price as (280.69 – 283.46) = -2.77.
Similarly, for 26-04, Change in price = (Current closing price – Previous closing price) = (285.48 – 280.6) = 4.79. We will then tabulate the results in the column mentioned as “Change (2)”. In this manner, we calculated the change in price.
Step 3: Gain and Loss
We will now create two sections depending on whether the price increased or decreased, with respect to the previous day’s closing price.
If the price has increased, we note down the difference in the “Gain” column, and if it’s a loss, then we note it down in the “Loss” column.
For example, on 26-04, the price had increased by 4.79. Thus, this value would be noted in the “Gain” column.
If you look at the data for 25-04, there was a decrease in the price by 2.77. Now, while the value is written as negative in the “change” column, we do not mention the negative sign in the “Loss” column. And only write it as 2.77. In this manner, the table for the columns “Gain (3)” and “Loss (4)” is updated.
In the next article, Rekhit will discuss Average Gain and Loss
Disclosure: Interactive Brokers
Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.