No history yet

RSI Calculation Logic

The Engine of RSI

The Relative Strength Index, or RSI, measures the speed and change of price movements. It doesn't predict the future, but it does quantify momentum. To truly understand its signals, you need to look under the hood at its calculation. At its core, the RSI compares the average size of recent gains to the average size of recent losses.

Let's break it down. For any given period, typically 14 periods on a trading chart, you first calculate the gain or loss. If the current price is higher than the previous price, it's a gain. If it's lower, it's a loss. The RSI formula then averages these gains and losses separately over the lookback period.

The first crucial component is a value called Relative Strength (RS). This is a simple ratio.

RS=Average GainAverage LossRS = \frac{\text{Average Gain}}{\text{Average Loss}}

A high RS value indicates strong upward momentum, while a low RS value indicates strong downward momentum. However, the RS value isn't bound to a neat scale, which makes it hard to use for standardized signals. To solve this, the RS value is plugged into a second formula that normalizes it into an oscillator, a value that always moves between 0 and 100. This is the RSI.

RSI=1001001+RSRSI = 100 - \frac{100}{1 + RS}

The 'Average' Is Not So Simple

The term "average" in the RSI calculation is a bit misleading. It’s not a simple arithmetic mean. Instead, RSI uses a specific smoothing technique that gives more weight to recent data. This is called an exponential moving average.

For the very first calculation of a 14-period RSI, you take a simple average of the gains and losses over the first 14 periods. But for every subsequent period, the calculation changes to incorporate the new data while still remembering the old.

AvgGaint=(AvgGaint1×13)+CurrentGaint14\text{AvgGain}_t = \frac{(\text{AvgGain}_{t-1} \times 13) + \text{CurrentGain}_t}{14}

Consider a 15-minute chart. If a stock experiences a sudden, large price spike in one 15-minute candle, the CurrentGain for that period will be significant. This immediately pulls the Average Gain higher, causing the RSI to jump. However, in the following candles, unless the gains continue, the influence of that single spike will be reduced by a factor of 13/14 in each new calculation. This creates the 'velocity' you see in the indicator; it reflects not just the existence of gains, but their recent magnitude and consistency.

Why RSI Gets Pinned

Understanding this smoothing logic explains why the RSI can get "pinned" in overbought or oversold territory during a strong trend. If a stock on a 15-minute chart keeps posting strong gains period after period, the Average Loss term in the RS calculation shrinks toward zero. As the denominator of the RS formula gets smaller, the RS value explodes, pushing the RSI toward 100.

The RSI won't fall until the asset starts posting losses large enough and consistently enough to significantly increase the Average Loss denominator.

This is why an RSI reading above 70 isn't an automatic sell signal, especially in a strong uptrend. It's simply a mathematical reflection that average gains have been overwhelming average losses. The instrument is displaying strong compared to its own recent history. The same is true in reverse for a reading below 30 in a downtrend. By knowing the math, you move from simply seeing a number to understanding the momentum story it's telling.

Mastering the calculation logic transforms the RSI from a black-box indicator into a transparent tool. You can now better diagnose why the indicator is behaving a certain way and make more informed decisions, knowing the precise mechanics of momentum at play.