Lesson 3 of 7
Trend and moving averages
Learning goal
Calculate a simple moving average, decide whether an index sits above or below it, and explain why sideways markets cause whipsaws.
Explanation
A trend is the general direction of prices over time: up, down, or sideways. Trends are never smooth. Prices zigzag inside them. A trend helps you ignore the zigzag.
A simple moving average (SMA) smooths prices. Take the last X weekly closes, add them, and divide by X. Next week, drop the oldest value, add the newest, and calculate again. The average "moves" forward.
The average lags. It reacts after prices move. A short average (10 weeks) reacts fast and gives more false alarms. A long average (50 weeks) reacts slowly and gives fewer.
The common rule: when price is above its average, the trend is up. When price is below its average, the trend is down.
Whipsaw. In a sideways market, prices cross above and below the average again and again. A rule that follows each cross buys high, sells low, and repeats. Each switch loses a little. Switches also cost money. This pattern is a whipsaw. Trend rules work best when there are long trends and fail when markets drift sideways.
Worked example
A 5-week SMA (the challenge uses 10 to 50 weeks; 5 keeps the arithmetic short). Weekly closes: 100, 102, 101, 105, 107, 104, 103.
- At week 5: (100 + 102 + 101 + 105 + 107) / 5 = 515 / 5 = 103.0. The index is 107, above 103. Trend up.
- At week 6: (102 + 101 + 105 + 107 + 104) / 5 = 519 / 5 = 103.8. The index is 104, above 103.8. Still up, barely.
- At week 7: (101 + 105 + 107 + 104 + 103) / 5 = 520 / 5 = 104.0. The index is 103, below 104. Trend broken.
Whipsaw: a sideways index closes at 103, 99, 104, 98 in weeks 1 to 4, and its average stays near 101. A follower buys at 103 (above), sells at 99 (below), buys at 104, sells at 98. Results: 99/103 = 0.961 and 98/104 = 0.942. Together: 0.961 × 0.942 = 0.906, a loss of about 9.4%. The index itself went from 100 to 98, down 2%. The rule did worse than doing nothing.
Self-check
Weekly closes are 30, 33, 36, 27. What is the 3-week SMA at week 4? Is the index above or below it?
Show the answer
Answer: SMA = (33 + 36 + 27) / 3 = 96 / 3 = 32. The index is 27, which is below the average.
What is a whipsaw, and what kind of market causes it?
Show the answer
Answer: A whipsaw is a series of false signals: price crosses above and below its average repeatedly, and a rule that follows each cross loses a little every time. Sideways markets cause it.
You hold an industry with a trend filter. At week 10 it is stopped. At week 11 it climbs back above its average. The next rebalance is six weeks away. When can it return to the fund?
Show the answer
Answer: Not until the next rebalance, six weeks away. A stopped industry holds cash until then, even if it recovers. At that rebalance it returns only if it is selected again and is not below its average (a newly selected industry below its average is stopped at once).
