Your first oscillator
A moving average is a smoother — it blends past prices into a trend line. RSI is different: it's an oscillator, a number bounded between 0 and 100 that measures the speed of the move rather than its direction.
J. Welles Wilder Jr. invented it in 1978, published in New Concepts in Technical Trading Systems alongside ADX and Parabolic SAR — a whole toolkit in one book. He wanted to fix two problems with raw momentum: price shocks at the edge of the lookback window, and no fixed range to read from.
The RSI formula not only provides the necessary smoothing, but also solves the latter problem by creating a constant vertical range of 0 to 100. — John Murphy, paraphrasing Wilder
A quick naming trap, called out by Murphy:
The term 'relative strength,' incidentally, is a misnomer. Wilder's Relative Strength Index doesn't really measure the relative strength between different entities.
The name compares today's gains to today's losses, not one asset vs another. Most people confuse it with sector-relative-strength analysis, which is a different thing entirely.
The formula
To compute it for period :
- For each bar, compute the up-change (close − previous close, floored at 0) and the down-change (absolute of close − previous close, floored at 0).
- Seed with a simple average over the first bar-to-bar changes: initial is the mean of the first up-changes; initial is the mean of the first down-changes.
- Recurse using Wilder's own smoothing:
Critical detail, commonly missed: Wilder's smoothing is not a standard EMA. A normal EMA uses (so for , ). Wilder uses (for , ) — nearly half as responsive. Kaufman calls this the average-off method and warns explicitly that swapping one formula for the other will produce numerically different RSI values and different signals. If you're porting an RSI into Pine, NumPy, or TradingView's ta.rsi(): the library will use Wilder's $1/N$ by default; be careful with any hand-rolled version.
The defaults and why
Wilder's original defaults — still the standard 45 years later:
| Parameter | Wilder's value | Rationale |
|---|---|---|
| Period | 14 | "one-half of a natural cycle… half of 28 calendar days" (Murphy paraphrasing Wilder) |
| Overbought | 70 | ⅓ quantile of an arbitrary balanced-market distribution |
| Oversold | 30 | Mirror |
Murphy notes that in strong bull/bear markets the bounds shift:
Because of shifting that takes place in bull and bear markets, the 80 level usually becomes the overbought level in bull markets and the 20 level the oversold level in bear markets.
Translation: tune tighter when the market is strong. In a raging bull, RSI readings in the 70s are normal; you need 80+ to get a meaningful extreme. In a vicious bear, 30 is normal; wait for 20s. The beginner who robotically buys at RSI=30 during a 40% drawdown is feeding himself to the tape.
Play with it
Turn the market to up and notice: RSI spends huge chunks of time above 70. Kaufman's warning, verbatim:
If prices continue higher for more than 14 days, then the RSI, as with other oscillators, will go sideways at the maximum value, 100.
This is the overbought trap. Most beginners assume "overbought = overvalued = short." Murphy's counter is the single most important RSI passage in the book:
In strong uptrends, overbought markets can stay overbought for some time. Just because the oscillator has moved into the upper region is not reason enough to liquidate a long position (or, even worse, short into the strong uptrend). — Murphy
And the corollary:
The first move into the overbought or oversold region is usually just a warning. The signal to pay close attention to is the second move by the oscillator into the danger zone.
Read as a rule: never act on the first overbought print in a new trend. Watch for the second.
Divergence — the signal that actually works
Wilder himself called divergence:
The single most indicative characteristic of the Relative Strength Index.
Bearish divergence: price makes a higher high, but RSI makes a lower high. Price is still climbing; the speed of the climb isn't. That gap is momentum leaking out of the trend — and it often precedes a reversal.
Bullish divergence: mirror. Price makes a lower low, RSI makes a higher low. The market is still grinding down, but with less force.
Click the button to reveal the markers. Notice: this example was hand-crafted to be clear, which is itself a lesson — in real charts, divergences are messier, and Kaufman has a hilariously honest line about this:
It is easier to find divergence by looking at a chart on a quote screen than to program it into a computer. You will find that this program does not always find the divergence that seems obvious to the eye. — Kaufman, Trading Systems and Methods
Kaufman's rules for reliable divergence, pulled straight from his divergence section:
- Longer timeframes are more reliable. Monthly > weekly > daily > intraday. Intraday divergence is mostly noise.
- Bigger time gaps = bigger forecast moves. Divergence over months predicts larger reversals than divergence over days.
- Start from extreme readings. Divergence that develops while RSI is still comfortably above 70 (or below 30) is the strongest.
- Multiple divergences are more reliable than single. Three-push divergences (three price peaks, three RSI lower highs) are especially potent.
The best single sentence on divergence's role: Murphy's warning about using it to fight trends.
The danger in placing too much importance on oscillators by themselves is the temptation to use divergence as an excuse to initiate trades contrary to the general trend. This action generally proves a costly and painful exercise.
Translation: divergence is a warning, not a reversal signal. Combine it with structure — a broken trendline, a broken support, a lower high on the price chart. Never let RSI alone talk you out of the trend.
The midpoint: 50
Less famous but worth knowing — the RSI's 50 level is a line most traders ignore and shouldn't. In a healthy uptrend, RSI rarely dips below 50 on pullbacks; in a healthy downtrend, it rarely rallies above 50 on bounces. Murphy:
The 50 level is the RSI midpoint value, and will often act as support during pullbacks and resistance during bounces. Some traders treat RSI crossings above and below the 50 level as buying and selling signals.
Practical: use RSI=50 as a regime filter. If RSI is above 50, long setups have tailwind; if below 50, short setups have tailwind. This is cleaner than 70/30 and avoids almost all of the overbought-trap.
Tuning the period
A 14-day period was Wilder's choice — and cycle research he leaned on. Other defensible periods:
- 5 or 7 — Murphy: "increase the volatility of the RSI line." More signals, much more noise.
- 21 or 28 — smoother, later, more conservative. Good for weekly charts.
- 2 (with 10/90 thresholds) — a 2013-era Michael Stokes variant documented by Kaufman. Treated as a mean-reversion indicator, not a trend-follower. Interesting edge case: Kaufman notes it worked as a trend indicator before 1998 and as a mean-reverter after. Regime-dependence is the rule, not the exception.
Don't period-optimize on your own chart. The way you're supposed to tune an indicator is by matching its period to a hypothesis about the dominant cycle (14 days ≈ ½ of a monthly cycle, per Wilder). Grid-searching period values until your backtest looks good is curve-fitting — a different activity than analysis.
RSI vs Stochastic vs Williams %R
RSI is in a family of bounded oscillators. Murphy's direct comparison:
The RSI line is less volatile and reaches extremes less frequently than stochastics.
- Stochastic — faster, more sensitive, exaggerates swings. Good when you want more signals.
- Williams %R — conceptually an inverted stochastic.
- RSI — slower, smoother, fewer extreme prints. Good when you want fewer, cleaner signals.
Murphy's actual recommendation, repeated in several forms:
It's also a good idea to combine stochastics with RSI. The best signals occur when both oscillators are in overbought or oversold territory.
The canonical move is to stack oscillators rather than pick one. Agreeing extremes across RSI+Stochastic is stronger than either alone.
Hidden traps
- Wilder's smoothing ≠ EMA. Already covered, but it's worth saying twice. Porting RSI between libraries will silently change your numbers if you're not careful.
- Early-trend overbought readings are useless. Murphy: oscillators matter late in a move, not early.
- RSI doesn't cap at 100 because it can't — it caps because the ratio of all-gains-to-no-losses is infinite and the formula returns 100. If RSI has been at 100 for 3 days, there has been no down day for 14 bars. That's a fact about price, not about the indicator.
- The name is a misnomer. Worth reminding yourself every time: this is not relative-strength analysis in the sector-rotation sense.
Quick check
You port RSI from a spreadsheet into Python and use `pandas.ewm(span=14).mean()` for the gain/loss smoothing. Your numbers don't match TradingView. Why?
What you now know
- RSI is a bounded oscillator (0–100) measuring the speed of the move, not direction.
- The formula uses Wilder's smoothing () — NOT a standard EMA. Porting-across-libraries gotcha #1.
- 70/30 thresholds are warnings, not triggers. In strong trends the bounds shift to 80/20; in ranges, tighter if you like, but fewer signals.
- The first trip to the overbought zone is just a warning. The second one — especially with divergence — is the signal.
- Divergence is RSI's best feature per Wilder himself. Most reliable on longer timeframes, from extreme readings, confirmed by price structure.
- The 50 midpoint is an under-used regime filter: long setups work better above 50, short setups below.
- Combine with other oscillators. Murphy's standard advice: RSI + Stochastic agreement beats either alone.
Next: MACD — not an oscillator like RSI but a difference of smoothers. Where RSI measures speed on a bounded scale, MACD measures the spread between two trends and has no bound. Different tool, different question.