RSI Calculation and Example



How to Calculate the Relative Strength Index (RSI)

The Relative Strength Index (RSI) is a momentum oscillator used in technical analysis that measures the speed and change of price movements. RSI oscillates between zero and 100 and is typically used to identify overbought or oversold conditions.

Initial RSI Calculation

The RSI is calculated using the following steps:

  1. Calculate Average Gains and Losses: This is typically done over a 14-day period. For each day, determine whether the price has gone up or down from the previous day. Sum up all the gains and losses respectively and then divide each by the period (e.g., 14 days).
  2. Compute Relative Strength (RS): This is the ratio of average gain to average loss. RS = Average Gain / Average Loss
  3. Calculate RSI: The RSI formula is then applied to get the final value. RSI = 100 - (100 / (1 + RS))

Example Calculation

Assume you have the following daily closing prices over 15 days:

  • Day 1: $100, Day 2: $102, Day 3: $101, Day 4: $105, Day 5: $103, Day 6: $110,
  • Day 7: $108, Day 8: $109, Day 9: $112, Day 10: $115, Day 11: $117, Day 12: $120,
  • Day 13: $118, Day 14: $121, Day 15: $123

Follow these steps to calculate the initial RSI:

  1. Calculate Daily Changes: Compute the change from one day's closing price to the next and identify gains and losses.
  2. Sum Gains and Losses: From these changes, calculate the total gains and losses over the 14-day period after the first day.
  3. Calculate Averages: Average Gain = Total Gains / 14, Average Loss = Total Losses / 14.
  4. Calculate RS and RSI: Use the formulas provided above to calculate RS and then RSI.

Next Day RSI Calculation

To calculate the RSI for the next day, you can use the following updated formula:

  1. Calculate the New Change: Determine if the new closing price (Day 16) is higher or lower than the previous day (Day 15).
  2. Update the Average Gain and Loss: The formulae to update are:
    • New Average Gain = (Previous Average Gain * 13 + New Gain) / 14
    • New Average Loss = (Previous Average Loss * 13 + New Loss) / 14
  3. Compute the New RS and RSI: RS = New Average Gain / New Average Loss RSI = 100 - (100 / (1 + RS))

Example: If the new closing price on Day 16 is $125 (a gain), and the closing price on Day 15 was $123:

  • New Gain = $2, New Loss = $0
  • Update and calculate the RSI as shown.

If the new closing price on Day 16 is $120 (a loss):

  • New Gain = $0, New Loss = $3
  • Update and calculate the RSI similarly.