The Analyst's Path

Moving average crossover

The crossover rule is the most quoted mechanical rule in the business: hold the asset while the fast average is above the slow one, stand aside otherwise. Fifty and two hundred sessions are the conventional lengths, and the crossings have names, the golden cross upward and the death cross downward, that do a lot of work in headlines and none in arithmetic. When the averages converge, the crossover rule stops being a trend filter and becomes a coin, and it charges you every time the coin lands.

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

Advertisement

A simple moving average of length n is the arithmetic mean of the last n closes. It is a low-pass filter, and its lag is roughly (n minus 1) divided by 2 sessions for a steadily trending series. Each new session adds one close and drops one, so the average moves by the difference between them divided by n, which is why the value that drops out matters as much as the one that arrives.

An exponential moving average weights recent closes more heavily. With smoothing constant k equal to 2 divided by (n plus 1), each new value is EMA = close × k + previous EMA × (1 − k). For n equal to 5, k is 0.333333. Seeded on the first simple average, the ten closes in the first practice problem give a five-session simple average of 108.2600 at the final close and an exponential average of 108.3236, a gap of 0.0636.

The exponential version turns faster and whipsaws more.

Advertisement

How does the crossover rule work?

The crossover rule is the most quoted mechanical rule in the business: hold the asset while the fast average is above the slow one, stand aside otherwise. Fifty and two hundred sessions are the conventional lengths, and the crossings have names, the golden cross upward and the death cross downward, that do a lot of work in headlines and none in arithmetic.

Structurally, a trend-following rule is a long option position financed by turnover. It cuts the left tail, because a sustained decline eventually pushes the fast average below the slow one and takes you out. It pays for that protection with two costs. The first is the transaction stack, which is small per trade and large per year at high turnover. The second, much bigger, is the premium you pay in a rising market for being out of it during every false alarm.

Worked example: 800 sessions of Sahyadri Ceramics

Worked Example 1 prices both. On eight hundred sessions of Sahyadri Ceramics the rule made five round trips, of which three lost money, and paid ₹2,900.86 in statutory charges on ₹3,00,000 of capital, which is 0.9670%. The rule ended at plus 6.86% against buy-and-hold at plus 53.52%. It was in the market for 275 of 599 sessions, so it missed 54% of the time in a series that rose 81.28% overall, and that is where the shortfall came from.

The whipsaw cluster is the part worth staring at. Three of the eight crossovers, at sessions 577, 588 and 591, were reversed within thirty sessions, and two of them within three. Look at why. Across the whole window the two averages were within half a percent of each other on 38 of 601 sessions, but 23 of those 38 fell in the sixty sessions from 560 to 619. When the averages converge, the crossover rule stops being a trend filter and becomes a coin, and it charges you every time the coin lands.

The two round trips those crossings produced cost ₹1,011.83 in charges and lost ₹2,252.03 net.

Can a filter fix the whipsaws?

The obvious repair is a filter, and the obvious filter is a minimum holding period. Refuse to reverse inside thirty sessions and the rule makes four round trips instead of five and finishes at plus 6.23%, which is ₹1,898.83 worse. So a filter fitted to the whipsaws you can see does not reliably help even in the sample it was fitted to, let alone in the next one.

Every parameter you add to fix a visible failure is another trial to count when you deflate.

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.