Module 1: RSI Foundations for Day Traders

How RSI Actually Works: The Math Behind the Indicator - Part 3

8 min readLesson 3 of 10

Welcome back, astute traders. In the previous two parts of "How RSI Actually Works," we laid the groundwork by dissecting the fundamental components of the Relative Strength Index: the calculation of average gains and average losses. We delved into the intricacies of positive and negative price changes and how they contribute to the initial RSI value. Now, in Part 3, we're going to pull it all together. We'll explore how these average calculations are smoothed, how the Relative Strength (RS) factor is derived, and finally, how the RSI formula translates this into the oscillator value we see on our charts.

Understanding this final step is crucial. It’s not just about knowing the formula; it’s about appreciating the smoothing effect and the normalization process that gives RSI its predictive power and its bounded nature (0-100). This isn't just academic; it directly impacts how you interpret overbought/oversold conditions, divergences, and momentum shifts in real-time trading.

The Smoothing Mechanism: Refining Average Gains and Losses

Recall from Part 2 that our initial average gain (AG) and average loss (AL) calculations are simple moving averages over a specified period (typically 14 periods). While simple averages are easy to understand, they have a significant drawback: they give equal weight to all data points within the lookback period, and when a new period is added, the oldest period is abruptly dropped, potentially causing jerky movements in the indicator.

To address this, J. Welles Wilder Jr. employed a smoothing technique that is essentially an Exponential Moving Average (EMA) applied to the average gains and losses. This gives more weight to recent price action, making the RSI more responsive to current market conditions while still retaining the benefit of historical context.

Let's revisit our calculations for Average Gain (AG) and Average Loss (AL) and see how they are smoothed.

Step 1: Initial Period Calculation (The First 14 Periods)

For the very first 14-period RSI calculation, you still use a simple average for the initial Average Gain and Average Loss.

  • Initial Average Gain (AG_initial) = Sum of all positive price changes over the first 14 periods / 14
  • Initial Average Loss (AL_initial) = Sum of all absolute negative price changes over the first 14 periods / 14

Let's use a hypothetical example. Imagine we're tracking a stock, say XYZ Corp, on a 5-minute chart. Our RSI period is set to 14.

Example Data (Hypothetical 5-min closes for XYZ Corp):

PeriodClose PricePrice ChangeGainLoss
1$100.00---
2$100.50+0.500.500.00
3$100.25-0.250.000.25
4$101.00+0.750.750.00
5$100.75-0.250.000.25
6$101.50+0.750.750.00
7$101.25-0.250.000.25
8$102.00+0.750.750.00
9$101.75-0.250.000.25
10$102.50+0.750.750.00
11$102.25-0.250.000.25
12$103.00+0.750.750.00
13$102.75-0.250.000.25
14$103.50+0.750.750.00

Sum of Gains (first 14 periods): 0.50 + 0.75 + 0.75 + 0.75 + 0.75 + 0.75 + 0.75 = 5.00 Sum of Losses (first 14 periods): 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 = 1.75

AG_initial = 5.00 / 14 = 0.3571 AL_initial = 1.75 / 14 = 0.1250

These are our starting points for the smoothed calculations.

Step 2: Subsequent Period Smoothing (Beyond the 14th Period)

From the 15th period onwards, the smoothing formula kicks in. This is where the "Wilder's Smoothing" or "Modified Moving Average" (MMA) comes into play. It's often expressed as:

New Average = ((Previous Average * (n-1)) + Current Value) / n*

Where 'n' is the RSI period (e.g., 14).

Let's break this down for Average Gain and Average Loss:

  • Smoothed Average Gain (AG_current) = ((AG_previous * (14 - 1)) + Current Gain) / 14
  • Smoothed Average Loss (AL_current) = ((AL_previous * (14 - 1)) + Current Loss) / 14

Or, more commonly seen as:

  • Smoothed Average Gain (AG_current) = (AG_previous * 13 + Current Gain) / 14
  • Smoothed Average Loss (AL_current) = (AL_previous * 13 + Current Loss) / 14

Notice how the 'Current Gain' or 'Current Loss' is the single gain or loss from the most recent period, not a sum. The previous average is multiplied by (n-1), giving it significant weight, and then the current period's value is added before dividing by 'n'. This effectively gives the current period 1/n weight and the previous average (n-1)/n weight. This is precisely how an EMA works, with alpha = 1/n.

Let's continue our XYZ Corp example. Suppose for the 15th period:

Period 15: Close Price = $103.25 (Previous Close was $103.50) Price Change: -0.25 Current Gain: 0.00 Current Loss: 0.25

Now, let's calculate the smoothed averages for period 15:

AG_current (Period 15) = ((AG_initial * 13) + Current Gain) / 14 AG_current (Period 15) = ((0.3571 * 13) + 0.00) / 14 AG_current (Period 15) = (4.6423 + 0.00) / 14 = 4.6423 / 14 = 0.3316

AL_current (Period 15) = ((AL_initial * 13) + Current Loss) / 14 AL_current (Period 15) = ((0.1250 * 13) + 0.25) / 14 AL_current (Period 15) = (1.6250 + 0.25) / 14 = 1.8750 / 14 = 0.1339

You can see how the averages are constantly updated, with the most recent data having a slightly higher influence than the oldest data within the effective lookback period. This smoothing makes RSI much more stable and less prone to whipsaws than if a simple moving average were used for every period.

Practical Tip: This smoothing is why RSI is generally considered more reliable than a simple momentum oscillator. It reduces noise without significantly lagging the price. When you see a rapid change in RSI, especially after a prolonged trend, it signifies a strong shift in the average buying or selling pressure, not just a single candle's move.

Calculating Relative Strength (RS): The Ratio of Forces

Once we have our smoothed Average Gain (AG) and Average Loss (AL) for the current period, the next step is straightforward: calculate the Relative Strength (RS).

Relative Strength (RS) = Smoothed Average Gain / Smoothed Average Loss

This ratio is the heart of the RSI. It directly compares the magnitude of recent upward price movements to recent downward price movements.

Let's continue with our XYZ Corp example for Period 15:

AG_current (Period 15) = 0.3316 AL_current (Period 15) = 0.1339

RS (Period 15) = 0.3316 / 0.1339 = 2.4765

What does this RS value tell us? An RS value of 2.4765 means that, over the smoothed 14-period lookback, the average magnitude of upward price changes was approximately 2.47 times greater than the average magnitude of downward price changes. This clearly indicates a bullish bias in recent price action.

Key Insight:

  • RS > 1: Average Gains are greater than Average Losses. Bullish momentum.
  • RS < 1: Average Gains are less than Average Losses. Bearish momentum.
  • RS = 1: Average Gains equal Average Losses. Neutral momentum.

The further RS deviates from 1, the stronger the momentum in that direction. However, RS itself is an unbounded value (it can range from 0 to infinity), which makes it difficult to use as an oscillator for overbought/oversold conditions. This is where the final step comes in.

The Final Transformation: Normalizing RS into RSI

The final step in the calculation is to transform the unbounded Relative Strength (RS) into a bounded oscillator, the Relative Strength Index (RSI), which ranges from 0 to 100. This normalization makes it easy to compare momentum across different assets and timeframes and to define universal overbought and oversold levels.

The formula for RSI is:

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

Let's plug in our RS value for XYZ Corp at Period 15:

RS (Period 15) = 2.4765

RSI (Period 15) = 100 - (100 / (1 + 2.4765)) RSI (Period 15) = 100 - (100 / 3.4765) RSI (Period 15) = 100 - 28.765 RSI (Period 15) = 71.235

And there you have it! An RSI value of 71.235. This value is above 70, indicating that XYZ Corp is currently in an overbought condition on our 5-minute chart, according to the traditional interpretation of RSI.

Why this specific formula for normalization?

This particular formula effectively compresses the infinite range of RS into the finite range of 0 to 100.

  • As RS approaches 0 (meaning almost no gains, only losses), (1 + RS) approaches 1. 100 / (1 + RS) approaches 100. So, RSI approaches 100 - 100 = 0.
  • As RS approaches infinity (meaning almost no losses, only gains), (1 + RS) approaches infinity. 100 / (1 + RS) approaches 0. So, RSI approaches 100 - 0 = 100.
  • When RS = 1 (Gains = Losses), (1 + RS) = 2. 100 / (1 + RS) = 50. So, RSI = 100 - 50 = 50.

This mathematical transformation ensures that RSI is always between 0 and 100, with 50 representing a neutral balance between average gains and average losses.

Deeper Dive - The "Why 100 minus...": The formula can also be expressed as: RSI = RS * (100 / (1 + RS)) + (0 * (100 / (1 + RS))) which is not quite right. A more intuitive way to look at it is: RSI = 100 * (Average Gain / (Average Gain + Average Loss)) This formula directly expresses RSI as the percentage of total average price movement that is upward. Let's test this: RSI = 100 * (AG / (AG + AL)) Divide numerator and denominator by AL: RSI = 100 * ((AG/AL) / ((AG/AL) + 1)) Since AG/AL = RS, RSI = 100 * (RS / (RS + 1)) This is an alternative, and often more intuitive, way to express the formula. Let's test our example: RSI = 100 * (2.4765 / (2.4765 + 1)) RSI = 100 * (2.4765 / 3.4765) RSI = 100 * 0.71235 RSI = 71.235*

Both formulas yield the same result, but the second one often provides a clearer conceptual understanding: RSI is essentially a percentage representation of average gains relative to the total average movement (gains + losses).

Putting It All Together: A Full RSI Calculation Walkthrough (ES Futures)

Let's apply this to a real-world scenario, albeit with simplified data for clarity. Imagine you're day trading ES (E-mini S&P 500 futures) on a 1-minute chart. You've been tracking price for a while, and you have your previous 14-period smoothed Average Gain and Average Loss values.

Scenario: We are at the start of a new trading day. The market has been trending up for the last hour. Previous Period (e.g., end of yesterday's session or 14 periods ago):

  • AG_previous = 2.50 points
  • AL_previous = 0.75 points
  • RS_previous = 2.50 / 0.75 = 3.3333
  • RSI_previous = 100 - (100 / (1 + 3.3333)) = 100 - (100 / 4.3333) = 100 - 23.07 = 76.93

Now, let's track the next few 1-minute bars:

Bar 1 (Current Bar):

  • Close Price: 4500.00
  • Previous Close: 4499.00
  • Price Change: +1.00 point
  • Current Gain: 1.00
  • Current Loss: 0.00
  1. Calculate Smoothed AG and AL:

    • AG_current = ((AG_previous * 13) + Current Gain) / 14 AG_current = ((2.50 * 13) + 1.00) / 14 = (32.50 + 1.00) / 14 = 33.50 / 14 = 2.3929
    • AL_current = ((AL_previous * 13) + Current Loss) / 14 AL_current = ((0.75 * 13) + 0.00) / 14 = (9.75 + 0.00) / 14 = 9.75 / 14 = 0.6964
  2. Calculate RS:

    • RS = AG_current / AL_current = 2.3929 / 0.6964 = 3.4361
  3. Calculate RSI:

    • RSI = 100 - (100 / (1 + RS))
    • RSI = 100 - (100 / (1 + 3.4361)) = 100 - (100 / 4.4361) = 100 - 22.54 = 77.46

Notice how the RSI slightly increased from 76.93 to 77.46, reflecting the positive price change,

The Black Book of Day Trading Strategies
Free Book

The Black Book of Day Trading Strategies

1,000 complete strategies · 31 chapters · Full trade plans