The Curious Mathematics Of Moving Averages

 |  Includes: DIA
by: Gary Jakacky


Moving averages are widely used in economics and finance.

A great variety of lengths are used: 20-day, 50-day, 200-day, etc.

These contain different amounts of information, but not for the reason you think!

F. Scott Fitzgerald once penned a short story called "The Curious Case of Benjamin Button," about a fellow born old who grew younger as time passed. What a retirement nightmare that would present! A similar saga plagued King Arthur's tutor, Merlyn the Magician, who was born in the future and was aging backwards as Arthur's reign unfolded. Too bad they didn't have a stock market back in Arthur's time - he could have made a fortune!

If either of these two gentlemen hired a financial advisor, doubtless they would use one of analysts' most common tools: the moving average. And there lies the link to this article: the moving average has some curious features too. Investors use them to "smooth" daily fluctuations, hopefully making longer term trends stand out.

Moving averages come in all kinds and flavors, but the most commonly used is simple moving average, of various lengths. Most popular on Seeking Alpha are the 20-day, 50-day, and 200-day moving averages.

As a statistician, I hold one truth to be not so self evident. All moving averages are created equal. Specifically, all moving averages are two-day moving averages. I don't care if you use 20 days, 50, 200, or a million. They are all two-day MAs.

I show this in the example below. I use enough data that it "feels" like a moving average, but a small enough amount that it is easy to see. We use a ten-day moving average in our example.

Suppose we just bought a wonderful stock at $1 a share and saw it gain one dollar each day for the next few weeks.

We all know to calculate the ten-day moving average: on day ten we add up the prices of the past 10 days; and divide by ten. The next day we add up days two through eleven and use the same divisor, right?

You can do it that way... but if you do you are a lousy statistician and an inefficient programmer. Why? All that changed on the eleventh day was the price from day one dropped out, and the price from day eleven dropped in. The other eight days in the middle were exactly the same in both calculations. The table below will shortly make this evident.

Thus, I can cleverly calculate the moving average by adding simply the first and tenth day, and dividing by two; the next value of the MA is the sum of days two and eleven, also divided by two. This simple "beginning and end" approach works for any moving average of any length. [as all statistics professors say, the proof is left to the reader.]

In the table below, the first row shows the price for days one through ten; the second row, days two to eleven. The sum, divided by ten, is then shown; and for your viewing pleasure and chagrin, the first and last days are summed, and divided by two. Same result!

$ Price Data by day Sum Sum/10 First and Last (F&L)/2
1 2 3 4 5 6 7 8 9 10 - 55 5.5 1 + 10= 11 5.5
- 2 3 4 5 6 7 8 9 10 11 65 6.5 2 + 11= 13 6.5
Click to enlarge

Well bust my Buttons! I bet all you folks who write software for your indicators have been doing it the long way all these years! Such inefficient programming! Why add ten digits when you can add just two!

If they are all two-day moving averages, then why do they convey different information about trends to investors? Simple: the longer the moving average, the further apart (timewise) the first and last days are. It is the breadth of this interval - not the number of data points between the beginning and end - that gives the various moving averages different sensitivities to short- versus long-term trends. A stock that is higher in price than 200 days (or 40 weeks) ago has demonstrated considerable spunk and rigor. One higher than just two weeks ago, not so much.

So longer term moving averages contain more information than shorter ones do, but this has nothing to do with the denominator, which may as well be two divided into first plus last. Durable trends stand out over time, that is why long-term investors were so happy when the Dow Jones Industrial ETF (NYSEARCA:DIA) 200-day moving average showed support earlier this month. But only two days really mattered!

The same applies to economic data such as unemployment claims or durable goods, where moving averages are also used to "smooth out fluctuations."

Disclosure: The author is long IHI, XLV.

The author wrote this article themselves, and it expresses their own opinions. The author is not receiving compensation for it (other than from Seeking Alpha). The author has no business relationship with any company whose stock is mentioned in this article.