How it works
RSI compares the average size of the up closes in a lookback window with the average size of the down closes, then squashes that ratio onto a bounded 0-100 scale. Two properties follow from that construction and explain most of how the indicator behaves. First, it is a ratio, so it is dimensionless: an RSI of 62 means the same thing on a $4 stock and on a $70,000 index, which is why it travels between instruments far better than MACD or raw momentum. Second, it is bounded, so it can never run away from you — but it also saturates, and a saturated oscillator stops carrying information.
The name is a historical accident worth clearing up, because it misleads new readers constantly. 'Relative strength' in most of finance means one asset measured against another, or against a benchmark. RSI does nothing of the sort. Everything it computes comes from a single price series; the 'relative' refers only to gains measured relative to losses inside that same series. Nothing about sector rotation or relative performance is present in the number.
In practice the strongest reading of RSI is not the 70/30 thresholds but the range the oscillator occupies over a stretch of bars. A market in a healthy uptrend tends to bottom out around 40-50 on pullbacks and push into the 80s on advances; a downtrend caps out near 55-60 and visits 20. When the oscillator suddenly fails to reach a level it has been reaching for months, the character of the move has changed before price has confirmed anything. That shift in the operating range is the signal experienced users actually watch, and it is far more robust than any fixed line.
Against its neighbours: RSI is smoother and better behaved than the Stochastic Oscillator, which measures position in a range rather than the balance of gains and losses, and which pins at its extremes for long stretches in a trend. It is slower than Chande's CMO, which uses the same raw ingredients without Wilder's smoothing. And Stochastic RSI and Connors RSI are both attempts to sharpen exactly the weakness described above — RSI's tendency to sit in the middle of its range and say nothing for weeks at a time.
Divergence deserves a caveat rather than a paragraph of enthusiasm. A lower RSI high against a higher price high says momentum on this leg was weaker than on the last one, which is true and sometimes useful. It does not say the trend is over. Strong trends produce three or four divergences on the way up, and every one of them is a losing short until the last.
Calculation
The arithmetic in words, in the order it happens.
Take the change in closing price from one bar to the next. Where the change is positive, record it as the gain and record a loss of zero; where it is negative, record its absolute value as the loss and a gain of zero. Seed the averages with a simple mean of the first N gains and the first N losses, then update each subsequent bar with Wilder's smoothing: new average = (previous average x (N - 1) + current value) / N. Relative strength RS is the average gain divided by the average loss, and RSI = 100 - 100 / (1 + RS). If the average loss is zero the formula is defined to return 100. The default N is 14. Note that Wilder's 1/N smoothing is slower than the usual 2/(N+1) EMA factor, so a 14-period RSI reacts about as slowly as a 27-period exponential average would.
Source
An AlgoBeamScript implementation of the formula above, written by us from the arithmetic so the code and the calculation agree line for line.
Runs unchanged on the platform and in the AlgoBeamTS runtime. The language reference is in the documentation.
Inputs
Defaults are the values most charting packages ship with. They are conventions, not optimal settings — the right length depends on your instrument and your holding period.
| Input | Default | What it changes |
|---|---|---|
| Length | 14 | Bars in the gain/loss averages. Lower it to 2-5 and the oscillator swings the full 0-100 range every few bars, which is what short-horizon mean-reversion systems want. Raise it to 21 or more and it flattens into something closer to a trend filter that rarely leaves the 40-60 band. |
| Source | Close | The price series the changes are measured on. Close is standard. Using hlc3 or a smoothed source damps single-bar spikes at the cost of another bar of lag; using open or high is unusual and mostly changes where the extremes print, not what they mean. |
| Overbought / oversold levels | 70 / 30 | Cosmetic guide lines, not part of the maths. Trend traders commonly redraw them at 80/40 for uptrends and 60/20 for downtrends so the lines match the range the oscillator is actually using in the current regime. |
| MA of RSI | Off (SMA 14 when enabled) | An optional moving average plotted on the oscillator itself. It gives RSI a signal line, converting level readings into crossover events, and pairs naturally with Bollinger Bands drawn on RSI to spot momentum extremes relative to recent momentum rather than to a fixed number. |
How to read it
What practitioners take from the plot. Read these as descriptions of market state, not as entry signals.
- Above 70
- Recent up closes have dominated recent down closes by a wide margin. In a range this often marks exhaustion. In an established trend it is confirmation of strength, and fading it is how traders end up short the best part of a move.
- Below 30
- Selling has dominated. Worth a mean-reversion look only when the larger structure is neutral or supportive; in a downtrend RSI can hold under 30 for weeks.
- Holding above 40 on pullbacks
- Classic uptrend signature. Dips are being bought before momentum turns properly negative, and the 40-50 zone is acting as a floor rather than a waypoint.
- Failure to exceed 60 on a rally
- The oscillator's ceiling has dropped. Buyers no longer generate the same push, and this usually precedes a change in trend character by several bars.
- Bearish divergence at a new price high
- This leg up was smaller or slower than the last. A warning about the quality of the advance, not a reversal signal on its own — wait for a structural break before acting on it.
Limitations
Where this indicator misleads. None of these are fixed by a better parameter.
- It saturates. In a strong trend RSI parks above 70 or below 30 and stays there, so every threshold-based countertrend rule fires early and repeatedly against the dominant direction.
- Wilder's smoothing makes it a lagging measure. The oscillator turns after price does, and on a 14-period setting the delay is comparable to a 27-period exponential average.
- Divergence is unreliable in isolation. Trends routinely print multiple divergences before topping, and divergence rules tested without a regime filter or a hard invalidation level rarely survive out of sample.
- In a quiet, drifting market RSI hovers around 50 and produces no usable information at all, while short settings on low timeframes generate near-continuous signals that are indistinguishable from noise after costs.
Educational reference. This page explains how an indicator is built and how it is commonly read. It is not investment advice, not a recommendation and not a signal service. No indicator is profitable on its own — each is a way of describing a market, and any rule built on one has to be tested with realistic costs before it is traded.