Technical Analysis
RSI, MACD and Stochastics: Momentum Indicators Explained
Three oscillators, three formulas, one column of closing prices. Build them by hand once and the redundancy between them becomes impossible to unsee.
I did not believe any of these three until I had built them in a spreadsheet, and the spreadsheet taught me two things the chart had been hiding. The first is how little work each formula does. The second is how much of that work all three of them duplicate.
RSI, including the smoothing step
The Relative Strength Index compares average gains with average losses over 14 periods:
RS = average gain / average loss and RSI = 100 - (100 / (1 + RS))
Suppose the last 14 daily changes contain gains adding to 5.60 and losses adding to 2.80. Then average gain = 5.60 / 14 = 0.40, average loss = 2.80 / 14 = 0.20, RS = 0.40 / 0.20 = 2.0 and RSI = 100 - (100 / 3) = 66.7.
After that first value, Wilder’s smoothing takes over, and each new value is a weighted update of the one before it:
average gain today = ((prior average gain x 13) + today's gain) / 14
Today the stock gains 0.90, so today’s loss is zero. The new average gain is ((0.40 x 13) + 0.90) / 14 = (5.20 + 0.90) / 14 = 0.4357. The average loss decays to ((0.20 x 13) + 0) / 14 = 2.60 / 14 = 0.1857. Then RS = 0.4357 / 0.1857 = 2.346 and RSI = 100 - (100 / 3.346) = 70.1.
Read what it took to print 70. Gains had to outpace losses by about 2.3 to one across a smoothed window. That is the entire content of the number. It says nothing about valuation. Nothing about the dollar size of the move, and nothing about tomorrow.
The formula also marks its own dead zone. As the average loss approaches zero the ratio blows up and RSI is pinned near 100, so a stock with no down close in 14 sessions reads 99 whether the daily gains were 0.1% or 4%, and anyone selling that reading as an extreme is selling a division by almost nothing.
What the 70 line costs in a trend
The standard use is simple. Sell above 70 and buy below 30. Inside an established range that behaves acceptably. Price genuinely oscillates between two areas, and the oscillator reaches its extremes near the edges.
In a trend it fails systematically. A stock in a powerful advance holds RSI above 70 for weeks, which is the indicator correctly reporting that gains keep exceeding losses, and fading each of those readings means shorting strength repeatedly while the losses compound precisely because the trend is generating the moves.
| Situation | RSI above 70 is reporting | Reasonable response |
|---|---|---|
| Price above a rising 200-day average | The advance is intact | Hold, manage the stop, stop adding at extension |
| Established range, price at the upper zone | Price has arrived where sellers acted before | A fade with invalidation above the zone |
| Late in a vertical move on climax volume | Momentum stretched and participation exhausted | Cut size, tighten risk |
Trend decides which row you are in. Settle it from price structure first. The technical analysis pillar sets out that sequence.
MACD at 12, 26 and 9
| Component | Formula | Example |
|---|---|---|
| MACD line | 12-period EMA - 26-period EMA |
51.80 - 50.40 = 1.40 |
| Signal line | 9-period EMA of the MACD line | 1.10 |
| Histogram | MACD line - signal line |
1.40 - 1.10 = 0.30 |
A positive MACD line says the 12-period average sits above the 26-period one, which is a restatement of the shorter trend being above the longer trend. A rising histogram says that gap is widening.
Because the inputs are exponential moving averages, MACD inherits everything they do. It lags. It whipsaws when price oscillates around the averages. It is arithmetically close to a 12 and 26 period crossover system. Displaying both and treating their agreement as confirmation counts one piece of evidence twice. The moving averages guide has the EMA calculation.
The formula also tells you where MACD is unusable: it is unbounded and it scales with price, so a MACD line of 1.40 describes a 2.8% separation on a $50 stock and a 0.28% separation on a $500 stock. Any screen that ranks stocks by raw MACD value is ranking them by price.
The stochastic oscillator
%K = ((close - lowest low over 14) / (highest high over 14 - lowest low over 14)) x 100
With a close of 47.50, a 14-day low of 44.00 and a 14-day high of 49.00: (47.50 - 44.00) / (49.00 - 44.00) = 3.50 / 5.00 = 0.70, so %K = 70. The %D line is a 3-period simple moving average of %K. The slow stochastic smooths %K once before that.
The design captures a real behaviour. In an advance, closes tend to land near the top of each day’s range. In a decline they land near the bottom. The oscillator measures that clustering across a window, which makes it the earliest of the three to register a change and therefore the one that registers the most changes that do not last.
Its dead zone is the denominator. If a stock has traded a 14-day range of only 0.50 on a $50 share price, a move of 0.35 carries %K from 0 to 70 while price has moved seven tenths of one percent. The oscillator is doing exactly what it was designed to do. The output describes nothing worth acting on. Check the range before you read the reading.
Three formulas, one input
Pick one momentum reading. Pair it with something measured from a different series.
| Pairing | Independent | Why |
|---|---|---|
| RSI and stochastics | No | Two bounded oscillators over the same closes |
| MACD and a 12/26 EMA crossover | No | Nearly the same calculation displayed twice |
| RSI and relative volume | Yes | Price momentum against share count |
| MACD and average true range | Yes | Direction against the size of daily ranges |
Volume is the only input on the chart that is not derived from price. That is why it is the valuable partner. The volume analysis guide covers the measurement. The volatility indicators guide covers the range-based measures that scale your stops.
Divergence, and what it refuses to tell you
Price makes a higher high at 58.20. RSI peaks at 68 against an earlier peak of 79. Fewer and smaller up closes contributed to the newer high than to the older one, which is a genuine observation and the most informative thing these three indicators produce.
It is also the most misused, because it carries no timing: divergence can persist for months while price continues to rise, and a trader who shorts each instance will be right eventually and broke first. Use it to raise a stop, reduce size or stop adding. Require an actual break in price structure before treating it as a reversal. Hidden divergence, where price makes a higher low while the oscillator makes a lower low, is the continuation version and behaves the same way: informative about condition, silent about when.
The thresholds are round numbers somebody chose
Nothing in the data makes 70 a boundary. The 70 and 30 lines on RSI, and 80 and 20 on the stochastic, were picked decades ago because they read cleanly on a printed chart. A stock whose typical daily move is 5% will visit 70 far more often than a utility that moves 0.6% a day, and neither visit means what the other one means.
If you want a threshold that adapts, compare today’s reading against that stock’s own distribution of readings over the past year, and let the fixed line go. I use that and I would still describe my confidence in any momentum threshold as low, because the underlying effect being measured is weak enough that reasonable settings produce contradictory answers.
The stock screener filters on RSI level alongside moving average position and relative volume, which lets you apply the trend context first and read the momentum figure second, in that order. Read the chart patterns guide for the structures these readings occur inside. Check the arithmetic with the chart patterns and indicators quiz.
Frequently asked questions
What is a momentum indicator?
A momentum indicator measures the speed and size of recent price changes rather than the level of price. RSI compares average gains with average losses, MACD subtracts one exponential moving average from another, and the stochastic oscillator locates the close inside the recent high to low range. All three are arithmetic performed on the same closing prices.
Does RSI above 70 mean sell?
No. RSI above 70 says recent gains have outweighed recent losses by roughly two to one or more, which is the definition of a strong advance. Powerful trends hold readings above 70 for weeks at a time, so a rule that sells every one of them is a rule that fights the dominant direction repeatedly.
How is MACD calculated?
The MACD line is the 12-period exponential moving average minus the 26-period exponential moving average. The signal line is a 9-period exponential moving average of the MACD line, and the histogram is the MACD line minus the signal line. The histogram therefore measures whether the gap between two averages is widening or closing.
What is divergence and is it reliable?
Divergence is a disagreement between price and the oscillator, such as price making a higher high while RSI makes a lower high. It reports that the newer high was reached with fewer and smaller up closes behind it. Divergence can persist for months before price responds, so it argues for tightening risk rather than for an entry.
Should I use RSI and stochastics together?
There is very little point. Both are bounded oscillators computed from the same recent closes, so they reach their extremes at roughly the same moments and one confirms the other by construction. Pair a momentum reading with something measured from a different series, which in practice means volume.
What settings should I use for RSI and MACD?
The defaults, which are 14 periods for RSI and 12, 26 and 9 for MACD. Those are the settings other participants are looking at, which is the only property of the numbers that is not arbitrary. Tuning the periods until past signals look better is curve fitting and the tuned values usually do worse out of sample.