RSI and a moving average: what they are
Relative Strength Index (RSI) is a momentum indicator that compares the average magnitude of recent gains to recent losses. RSI is displayed on a scale from 0 to 100, where higher values typically indicate stronger recent upward movement and lower values indicate stronger recent downward movement.
A moving average is a smoothing method that calculates an average price over a fixed number of past periods. A common choice is the simple moving average (SMA), which averages the last N closing prices. Moving averages do not predict future prices; they summarize what happened over the selected window.
How a worked example can be computed (with explicit assumptions)
This worked example uses made-up data to show the mechanics. Assumptions:
- We use 1-period price changes and closes only (no intraday data).
- RSI uses a 14-period lookback, calculated with Wilder’s smoothing (a standard RSI method).
- For RSI, we compute gains and losses for each period as:
- Gain = max(close_t − close_{t−1}, 0)
- Loss = max(close_{t−1} − close_t, 0)
- For moving average, we use a 10-period simple moving average (SMA-10) on closes.
- We choose a specific segment where RSI is already computable. Therefore, the first 14 periods serve only to establish the initial averages; the example focuses on showing one step clearly.
Hypothetical closes
Assume 15 closes (so RSI-14 can be initialized once you have enough data). Let closes for periods 0 through 14 be:
- Period 0 to 9 (steady gains): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109
- Period 10 to 14 (a drop): 108, 107, 106, 105, 104
From period 0→1 through 8→9, each change is +1 (a gain). From period 9→10 onward, each change is −1 (a loss).
Step A: Initialize RSI averages at period 14
RSI-14 uses the first 14 changes (periods 1..14) which correspond to gains for changes 1..9 and losses for changes 10..14.
- Total gains over the 14 changes = 9 periods × 1 = 9
- Total losses over the 14 changes = 5 periods × 1 = 5
Initial average gain = 9/14 = 0.642857… Initial average loss = 5/14 = 0.357142…
Compute Relative Strength (RS): RS = (average gain) / (average loss) = 0.642857… / 0.357142… = 1.8
Compute RSI: RSI = 100 − [100 / (1 + RS)] RSI = 100 − [100 / (1 + 1.8)] = 100 − [100 / 2.8] = 100 − 35.714285… = 64.285714…
So, at period 14, RSI is about 64.29 under these assumptions.
Step B: Compute the moving average at the same period
SMA-10 at period 14 averages closes from periods 5..14 (10 values): Closes: period 5=105, 6=106, 7=107, 8=108, 9=109, 10=108, 11=107, 12=106, 13=105, 14=104 Sum = (105+106+107+108+109) + (108+107+106+105+104) First five sum = 535; last five sum = 530; total = 1065 SMA-10 = 1065 / 10 = 106.5
Step C: Interpret the relationship between RSI and moving average
In this hypothetical snapshot:
- RSI ≈ 64.29 suggests that, over the last 14 periods, gains have outweighed losses.
- SMA-10 = 106.5 is a smoothed reference level for closes over the last 10 periods.
A combined interpretation might be described as: the recent momentum (RSI) is still positive relative to the recent history, even though the last several closes are below earlier highs in the window (as seen by the post-peak decline). Importantly, this is an interpretive summary of past behavior, not a prediction of what will happen next.
Limitations, risks, and how to verify what you computed
What can go wrong
- Parameter sensitivity: Different RSI lengths (e.g., 9 or 25) and different moving-average windows change the numeric results. The same market behavior can yield very different RSI values.
- Smoothing method differences: RSI implementations may vary (for example, they may use alternative smoothing or handle zero losses differently). That can shift RSI values.
- Indicator overlap is not proof: RSI and moving averages both derive from price history. When they appear to agree, it does not mean the relationship will persist.
- Regime changes: In trending markets, a momentum measure can stay elevated or depressed longer than expected; in choppy markets, it can oscillate frequently.