StockEducation
The advanced course

Chapter 27 · Oscillators

Oscillators

RSI, MACD, Stochastic and the rest — formulas, worked numbers, and the single most expensive misreading in technical analysis.

47 of 66 · 12 min

RSI and the two thresholds

1007050300overboughtoversoldRSI = 100 − 100 ÷ (1 + average gain ÷ average loss)
RSI is bounded at 0 and 100. Above 70 is called overbought and below 30 oversold, but in a strong trend it can sit at an extreme for weeks.

An oscillator measures rate of change rather than level. Most are bounded — RSI and Stochastic run 0 to 100 — which is what makes them look like they identify extremes. What they actually identify is that recent moves have been one-sided.

RSI, in full

StepFormula
Average gainSum of up-day changes over n ÷ n (default n = 14)
Average lossSum of down-day changes over n ÷ n
Subsequent periods (Wilder smoothing)(Previous average × (n − 1) + current value) ÷ n
Relative strengthRS = Average gain ÷ Average loss
RSI100 − 100 ÷ (1 + RS)

Worked: two RSI readings

  • Average gain Rs 3.2, average loss Rs 1.6 → RS = 2.0 → RSI = 100 − 100 ÷ 3.0 = 66.7.
  • Average gain Rs 1.0, average loss Rs 3.0 → RS = 0.333 → RSI = 100 − 100 ÷ 1.333 = 25.0.
  • Note what the formula does at the edges: with no down days at all, average loss is 0, RS is infinite, and RSI is exactly 100. With no up days, RSI is exactly 0. The scale is a ratio, not a probability.

Four ways RSI is read, in ascending order of usefulness

  1. 1Thresholds — above 70 'overbought', below 30 'oversold'. The most cited and the least reliable.
  2. 2The centre line — RSI persistently above 50 is an uptrend, below 50 a downtrend. Duller and considerably more robust.
  3. 3Divergence — price makes a higher high, RSI makes a lower high. The highest-value reading of the four.
  4. 4Failure swings — RSI turns down before reaching 70 in an uptrend, or fails to reach 30 in a downtrend. Wilder's own preferred signal, and largely forgotten.

MACD, signal line and histogram

zeroMACD = 12-EMA − 26-EMAsignal = 9-EMA of MACDhistogram = MACD − signal
The histogram is the gap between the MACD line and its signal line. It shrinks toward zero before every crossover, which is the part worth watching.

MACD

ComponentFormula
MACD lineEMA(12) − EMA(26)
Signal lineEMA(9) of the MACD line
HistogramMACD line − Signal line

Worked: EMA(12) = 428.4 and EMA(26) = 421.0, so the MACD line is +7.4. If the signal line is 5.9, the histogram is +1.5 — positive and, if it was +0.9 yesterday, rising. The histogram shrinking toward zero is the part worth watching, because it must reach zero before any crossover happens.

The rest of the family

IndicatorFormulaScale
Stochastic %K(Close − Low(n)) ÷ (High(n) − Low(n)) × 1000–100
Stochastic %DSMA(3) of %K0–100
Williams %R(High(n) − Close) ÷ (High(n) − Low(n)) × −1000 to −100
CCI(Typical price − SMA) ÷ (0.015 × mean deviation)Unbounded, mostly ±100
ROC(Price − Price(n periods ago)) ÷ Price(n) × 100Percentage
MomentumPrice − Price(n periods ago)In rupees
TRIXRate of change of a triple-smoothed EMAAround zero
Awesome OscillatorSMA(5) of median price − SMA(34) of median priceAround zero

Worked Stochastic: close 428, 14-day low 396, 14-day high 441. %K = (428 − 396) ÷ (441 − 396) × 100 = 32 ÷ 45 × 100 = 71.1. In plain language: the close sat 71% of the way up the last fortnight's range.

Overbought does not mean sell

This is the most expensive misreading in technical analysis, and it follows directly from the formula. RSI is high when recent moves have been mostly up — which is the definition of a strong uptrend. In a genuine trend, RSI can sit between 60 and 80 for weeks.

Selling the first 70 print in a new uptrend is how people exit at the start of the move that mattered. Wilder's own framing was that these levels flag a market worth examining, not a market to trade against.

How much weight indicators can carry

Saved in this browser only — there is no account to create. Clearing your browser data clears your progress.