The Analyst's Path

RSI indicator

The relative strength index (RSI) is an oscillator that compares recent average gains with recent average losses and maps the result onto a bounded scale. The conventional thresholds are 70 for overbought and 30 for oversold, and they are where most of the damage is done. In a strong trend the index pins above 70 for weeks, and selling every reading above 70 in a rising market is a reliable way to sell early and often.

4 min readPart of Technical Analysis and the Market's Own DataOpen in course mode

Advertisement

An oscillator is a bounded transformation of recent price changes, built so it moves within a fixed range whatever the price level. Three of them dominate practice and all three are simple enough to compute on paper.

How is the RSI calculated, and what do 70 and 30 mean?

The relative strength index was published by J. Welles Wilder in New Concepts in Technical Trading Systems (1978). Split each session's change into a gain or a loss, take a smoothed average of each over n sessions, form RS = average gain ÷ average loss, and map it to a bounded scale with RSI = 100 − 100/(1 + RS). Wilder's smoothing is not a simple mean: after the first value, seeded on the arithmetic mean of the first n gains and losses, each subsequent average is (previous × (n − 1) + today's value) ÷ n. Fourteen sessions is the standard length. An average gain of 1.8640 against an average loss of 0.9925 gives RS of 1.878086 and RSI of 65.2547.

Feel the asymmetry in the smoothing. From that same state, one further session up 2.30 takes the index to 67.2812; one further session down 3.10 takes it to 60.2269. A 5.40-point swing in the underlying price moved the oscillator 7.0543 points, and the reading you get depends entirely on where in the smoothing cycle you look.

The conventional thresholds are 70 for overbought and 30 for oversold, and they are where most of the damage is done. In a strong trend the index pins above 70 for weeks, and selling every reading above 70 in a rising market is a reliable way to sell early and often.

Wilder's own use was closer to divergence and failure swings than to threshold trading.

Advertisement

How are MACD and the stochastic oscillator calculated?

The moving average convergence divergence indicator, devised by Gerald Appel in the 1970s, is a difference of two exponential averages. The MACD line is the twelve-session exponential average minus the twenty-six-session one. The signal line is a nine-session exponential average of the MACD line. The histogram is the line minus the signal, so it crosses zero exactly when the line crosses the signal. It is not bounded, so the readings are only comparable within one series at one price level.

The stochastic oscillator, associated with George Lane, asks where today's close sits inside the recent range: %K = (close − lowest low) ÷ (highest high − lowest low) × 100 over n sessions, with %D the three-session mean of %K. Take twenty-four sessions of Fairbank Logistics (synthetic, US, $) that fall from a high of 47.60 to a low of 39.20 and then recover. The fourteen-session readings:

SessionClose14-session high14-session low%K%D
1439.5047.6039.203.5714
1541.4047.6039.2026.1905
1642.6047.6039.2040.476223.4127
1743.5047.6039.2051.190539.2857
1844.4047.6039.2061.904851.1905
1945.6047.6039.2076.190563.0952
2046.5047.2039.2091.250076.4484
2146.2047.5039.2084.337383.9259
2246.9047.5039.2092.771189.4528
2348.0048.2039.2097.777891.6287
2447.6048.9039.2086.597992.3823

Session 14 reads 3.5714 because the close sits almost exactly on the fourteen-session low. Five of the eleven readings sit above 80 and one below 20.

It is a range-position statistic, so in a sustained trend it does exactly what the relative strength index does and pins at one end.

What is divergence, and why is it abused?

Divergence is the idea that binds them, and it is the one worth taking seriously and the one most abused. A bearish divergence is a higher price high accompanied by a lower oscillator high; a bullish divergence is a lower price low with a higher oscillator low.

The reasoning is that the second push happened with less force behind it.

The abuse is the confirmation lag. A divergence requires two swing highs, and a swing high is not a swing high until the fractal window closes, which with a five-session rule is five sessions after the fact. Every divergence you can see on a chart became visible five sessions after the price it points at. Worked Example 2 finds four bearish and three bullish divergences on the index series and dates each one honestly, and Worked Example 3 tests what the rule was worth once the lag is respected.

What it was worth is not what the picture suggests.

Advertisement

Part of the course

This page is part of Technical Analysis and the Market's Own Data (M9.05), in Phase 9: Portfolio construction, risk and investment process. The module's flashcards and its quiz are in the app.