Module 1: RSI Foundations for Day Traders

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

8 min readLesson 9 of 10

Welcome back, traders. In this extensive module on RSI, we've explored its fundamental concepts, its role in identifying overbought and oversold conditions, and its limitations. Today, we're going to dive deep into the very core of the Relative Strength Index: its mathematical construction. Understanding the underlying calculations isn't just an academic exercise; it's a critical step in mastering the indicator. When you grasp how RSI is derived, you gain a profound appreciation for its nuances, enabling you to interpret its movements with greater precision and confidence. This knowledge will elevate your trading beyond simply reacting to lines on a chart; you'll understand why those lines are moving the way they are.

The Foundation: Average Gains and Average Losses

At its heart, RSI is a momentum oscillator that measures the speed and change of price movements. It accomplishes this by comparing the magnitude of recent gains to recent losses over a specified period. The standard period for RSI is 14, but as day traders, we often adjust this to suit our timeframes and trading styles. For instance, a 7-period RSI on a 1-minute chart will be far more reactive than a 14-period RSI on a 1-hour chart.

Let's break down the initial calculation steps.

Step 1: Identifying Up and Down Closes

For each period within our chosen lookback (e.g., 14 periods), we need to determine if the closing price was higher or lower than the previous period's closing price.

  • Up Close (Gain): If the current closing price is higher than the previous closing price, the difference is recorded as a "Gain." The "Loss" for that period is recorded as zero.
  • Down Close (Loss): If the current closing price is lower than the previous closing price, the difference is recorded as a "Loss" (as a positive number). The "Gain" for that period is recorded as zero.
  • Unchanged Close: If the closing price is the same, both "Gain" and "Loss" are recorded as zero.

Let's illustrate with a simplified 5-period example for a hypothetical stock, XYZ:

PeriodClose PriceChangeGainLoss
1$100.00---
2$101.50+1.501.500.00
3$100.80-0.700.000.70
4$102.20+1.401.400.00
5$101.90-0.300.000.30
6$103.50+1.601.600.00

Step 2: Calculating Initial Average Gains (AVG_Gain) and Average Losses (AVG_Loss)

For the very first calculation of RSI (i.e., after the specified lookback period has elapsed), we simply take a simple average of the Gains and Losses over that period.

Using our 5-period example (let's assume this is our chosen lookback for this initial calculation):

  • Sum of Gains (Periods 2-6): 1.50 + 0.00 + 1.40 + 0.00 + 1.60 = 4.50

  • Sum of Losses (Periods 2-6): 0.00 + 0.70 + 0.00 + 0.30 + 0.00 = 1.00

  • Initial AVG_Gain: Sum of Gains / Number of Periods = 4.50 / 5 = 0.90

  • Initial AVG_Loss: Sum of Losses / Number of Periods = 1.00 / 5 = 0.20

This initial calculation is straightforward. However, this is where many traders stop their understanding. The true genius of RSI lies in its subsequent smoothing.

The Smoothing Mechanism: Wilders' Smoothing

After the initial average is calculated, subsequent average gains and losses are not simple moving averages. Instead, J. Welles Wilder Jr., the creator of RSI, employed a specific smoothing technique similar to an Exponential Moving Average (EMA). This is crucial because it gives more weight to recent price changes, making the RSI more responsive while still providing a degree of smoothness.

The formula for subsequent periods is as follows:

Current AVG_Gain = ((Previous AVG_Gain * (Period - 1)) + Current Gain) / Period Current AVG_Loss = ((Previous AVG_Loss * (Period - 1)) + Current Loss) / Period

Where:

  • Period is the lookback period (e.g., 14).
  • Current Gain is the gain for the current period.
  • Current Loss is the loss for the current period (always positive).

Let's continue our 5-period example to demonstrate this smoothing:

Assume our initial AVG_Gain is 0.90 and Initial AVG_Loss is 0.20 from the previous 5 periods. Now, let's add a 6th period's data to calculate the next AVG_Gain and AVG_Loss:

Period 7: Let's say Close Price is $102.50. Previous Close (Period 6) was $103.50.

  • Change = -1.00
  • Current Gain = 0.00
  • Current Loss = 1.00

Now, apply the Wilder's smoothing formula:

  • New AVG_Gain: ((0.90 * (5 - 1)) + 0.00) / 5 = ((0.90 * 4) + 0.00) / 5 = (3.60 + 0.00) / 5 = 3.60 / 5 = 0.72
  • New AVG_Loss: ((0.20 * (5 - 1)) + 1.00) / 5 = ((0.20 * 4) + 1.00) / 5 = (0.80 + 1.00) / 5 = 1.80 / 5 = 0.36

Notice how the new averages are influenced by both the previous average and the current period's gain/loss. This exponential-like smoothing is what makes RSI a robust momentum indicator. If it were a simple moving average, it would react too slowly. If it were unsmoothed, it would be too erratic.

Practical Implication of Wilder's Smoothing for Day Traders

This smoothing technique is critical for day traders. It means that a sudden, significant move (e.g., a large spike in ES futures on a 1-minute chart) will have a more pronounced and lasting effect on the RSI than if it were a simple average. This helps prevent whipsaws from single, isolated price fluctuations while still ensuring responsiveness.

Consider a scenario in NQ futures on a 1-minute chart. If NQ suddenly drops $20 in one minute after a news announcement, that "Loss" will heavily influence the current AVG_Loss calculation. While subsequent periods might see smaller changes, that large initial loss will continue to contribute to the AVG_Loss for several periods due to the (Period - 1) multiplier, keeping the RSI lower for longer, indicating persistent bearish momentum even if the market attempts a shallow bounce. This is why understanding the "memory" built into RSI via Wilder's smoothing is vital for interpreting sustained momentum shifts.

The Final Step: Relative Strength (RS) and RSI

Once we have our Average Gains and Average Losses, the rest of the calculation is straightforward.

Step 3: Calculating Relative Strength (RS)

Relative Strength (RS) = Current AVG_Gain / Current AVG_Loss

This ratio is the core of the indicator. It directly compares the average magnitude of upward price changes to the average magnitude of downward price changes.

Using our example from Period 7:

  • Current AVG_Gain = 0.72
  • Current AVG_Loss = 0.36

RS = 0.72 / 0.36 = 2.00

A high RS value indicates that average gains are significantly larger than average losses, suggesting strong upward momentum. Conversely, a low RS value indicates that average losses are larger than average gains, suggesting strong downward momentum.

Step 4: Calculating the Relative Strength Index (RSI)

The final step converts the RS value into an oscillator that fluctuates between 0 and 100. This normalization makes the indicator easier to interpret across different assets and timeframes.

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

Let's calculate the RSI for our example:

RSI = 100 - (100 / (1 + 2.00)) = 100 - (100 / 3.00) = 100 - 33.33 = 66.67

So, for Period 7, our RSI would be approximately 66.67.

Why the 0-100 Scale?

The 0-100 scale is crucial for practical application. It allows us to define clear overbought and oversold thresholds (traditionally 70 and 30, respectively). Without this normalization, interpreting raw RS values would be far more challenging. Imagine trying to compare an RS of 2.5 for SPY to an RS of 1.8 for a volatile small-cap stock. The RSI scale provides a universal framework.

The Significance of the Period Setting

As day traders, the Period setting is one of the most impactful adjustments we can make.

  • Shorter Periods (e.g., 5, 7, 9):

    • Calculation Impact: A shorter period means that the (Period - 1) multiplier in Wilder's smoothing is smaller. This makes the RSI much more reactive to recent price changes. Each new bar's gain or loss has a proportionally larger impact on the AVG_Gain and AVG_Loss.
    • Day Trading Application: Ideal for very short-term scalping or identifying quick momentum shifts on 1-minute or 5-minute charts. An RSI(5) on a 1-minute chart will hit overbought (70+) or oversold (30-) levels much more frequently and quickly. This can generate more signals, but also more false signals if not filtered.
    • Example: On a 1-minute NQ chart, an RSI(7) might flash oversold at 20 several times in a strong downtrend, indicating potential bounces that may or may not materialize into sustained reversals. You'd need to combine this with price action and potentially other indicators.
  • Longer Periods (e.g., 14, 21, 28):

    • Calculation Impact: A longer period means the (Period - 1) multiplier is larger. This makes the RSI smoother and less reactive. It takes more sustained price action to move the RSI significantly.
    • Day Trading Application: Useful for identifying more significant, sustained momentum on 5-minute, 15-minute, or 30-minute charts. It reduces whipsaws and provides clearer, albeit fewer, signals.
    • Example: An RSI(14) on a 15-minute SPY chart hitting 30 might indicate a more reliable oversold condition for a swing bounce compared to a 1-minute RSI(7).

Practical Tip: Adjusting Period for Market Volatility

In highly volatile markets (e.g., during earnings season, news events, or high-volume sessions), a slightly longer RSI period (e.g., 9 or 10 instead of 7 on a 1-minute chart) can help filter out some of the noise and reduce premature signals. Conversely, in very quiet, range-bound markets, a shorter period might be necessary to catch any actionable momentum. Experimentation and backtesting are key here.

Edge Cases and What They Mean for Day Traders

Understanding the math helps us interpret extreme RSI values.

RSI Approaching 100 (Extreme Overbought)

If AVG_Loss approaches zero, meaning there have been virtually no down closes or very small ones compared to gains, then RS approaches infinity (a very large number).

RSI = 100 - (100 / (1 + Very Large Number)) which approaches 100 - (100 / Very Large Number) which approaches 100 - 0 = 100.

  • Day Trading Implication: An RSI hitting 90+ on a 1-minute chart for a stock like TSLA during a parabolic squeeze means that for the last Period bars, almost every bar has closed higher than the previous one, and the magnitude of those gains has been substantial. This signals extreme buying pressure and can be a precursor to a sharp, albeit short-lived, pullback as buyers exhaust themselves. It's a sign of a potential reversal or at least a pause.

RSI Approaching 0 (Extreme Oversold)

If AVG_Gain approaches zero, meaning there have been virtually no up closes or very small ones compared to losses, then RS approaches zero.

RSI = 100 - (100 / (1 + 0)) = 100 - (100 / 1) = 100 - 100 = 0.

  • Day Trading Implication: An RSI hitting 10 or less on a 5-minute chart for ES futures during a rapid sell-off means that the market has seen almost continuous down closes, with significant magnitudes. This indicates extreme selling pressure and often precedes a bounce. While it doesn't guarantee a full reversal, it suggests a high probability of short-term relief as sellers temporarily exhaust.

Important Note: RSI can stay in overbought/oversold territory for extended periods during strong trends. This is a common beginner mistake – blindly fading overbought/oversold. The math explains why: during a strong uptrend, AVG_Gain continues to be significantly higher than AVG_Loss, keeping RS high, and thus RSI high, even as price continues to climb. Price action and context are always paramount.

Putting It All Together: A Trade Example with RSI Math in Mind

Let's consider a scenario in SPY on a 5-minute chart. We're using a standard RSI(14).

Scenario: SPY has been trending down all morning. It's now hitting a key support level from yesterday's low.

Observation:

  • Around 10:30 AM EST, SPY drops rapidly from $450.00 to $448.50 over three 5-minute bars.
  • During this rapid drop, the AVG_Loss calculation is significantly increasing, and the AVG_Gain is decreasing, pushing the RSI lower.
  • At 10:45 AM, SPY hits $448.50, and its RSI(14) on the 5-minute chart drops to 25. This is deeply oversold.
  • The next 5-minute bar (10:50 AM) closes at $448.60 (a small gain of $0.10). This small gain will contribute to a slight increase in AVG_Gain and a potential decrease in AVG_Loss (if the previous bar was a loss).
  • The RSI ticks up from 25 to 27. This is a subtle bullish divergence (RSI turning up while price makes a lower low or flat low, though not explicit here, it's a first sign of momentum slowing down).
  • The 10:55 AM bar closes at $448.90 (a gain of $0.30). This larger gain further impacts the AVG_Gain calculation, and the RSI now moves to 32.

Decision Process based on Math Understanding:

  1. Extreme Oversold (RSI 25): The mathematical implication is that recent losses have been overwhelmingly dominant. This suggests seller exhaustion is imminent or already occurring.
  2. Price Action at Key Support: The bounce off $448.50, a prior day's low, adds confluence.
  3. RSI Turnaround (25 to 27 to 32): Even small positive closes start to shift the AVG_Gain/AVG_Loss balance. The Current Gain (even if small) starts to increase Current AVG_Gain, and if Current Loss is zero, Current AVG_Loss begins to decrease due to the (Period - 1) multiplier effect. This is the math showing a shift in momentum. The indicator is no longer registering overwhelmingly negative momentum.

Trade Execution:

  • Entry: Long SPY at $448.95 as the 10:55 AM bar closes, confirming the RSI turnaround from oversold territory and a bounce off support.
  • Stop Loss: Below the low of the support test, e.g., $448.30. This respects the price action.
  • Target: A prior resistance level or the 50-period EMA on the 5-minute chart, say $449.80.

Outcome (Hypothetical): SPY continues to bounce, reaching $449.80 within the next 30 minutes, allowing for a profitable scalp. The RSI would likely continue to climb, perhaps reaching 50-60, indicating a return to more neutral momentum.

This example illustrates how understanding the mathematical underpinnings allows you to interpret the meaning

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