An Intro to Moving Averages: Popular Technical Indicators
Over the last few articles, we have covered many of the basics of technical analysis, mainly chart types and pattern recognition. Having laid the foundation, it is time to move on to a more involved discussion and delve into the core of technical analysis—indicators—and how they are used in the analysis process and in the development of systematic trading strategies. To get things started, we will begin with one of the more basic, yet quite popular, indicators—moving averages.
Moving averages are among the oldest and most widely used technical analysis tools. Due to the relative ease with which they are calculated, moving averages are the preferred tools of newcomers to technical analysis. They have also found favor among some fundamental analysts who make decisions on fundamental factors such as earnings and sales but use moving averages to time buy and sell decisions. With the wide availability of computers and their increased use in financial analysis, you can now create moving averages covering several decades worth of data in a matter of seconds.
A moving average is defined as the average price of a security over a set time period. In essence, moving averages are “bending trendlines.” Remember that a trendline is typically drawn between two or more peaksor troughs in the price movement of a security. Over time, both trendlines and moving averages can be used to establish points of resistance or support for the price. However, moving averages overcome some of the criticisms of trendlines—mainly that they are subjective in their construction. While moving averages can be customized to meet individual needs, they are still based on cold, hard mathematical calculations. In addition, whereas straight-line trendlines are static in nature, moving averages portray dynamic levels of support or resistance as prices move.
Moving averages, by their very nature, smooth data. In other words, they tend to eliminate—or at least lesson the impact of—“blips” or outliers in price data. Moving averages show trends in price, but their nature is to represent the trend in a smoothed fashion.
When looking at either one or several moving averages plotted on a price chart, the interpretation is generally the same. As long as the current market price is above the moving average, an uptrend is in progress. On the other hand, if the current market price is below the moving average, a downtrend is occurring. When a security’s price violates a moving average from either the upside or downside, we can interpret this as a warning flag that the current trend may be coming to an end. If the reversal lasts long enough to change the direction of the moving average, this is usually considered an indication that the trend has ended.
In calculating a moving average, there are several factors you need to take into account, the most important of which are: the time period over which the average is calculated, the price input used in the calculation, and the type of average you wish to use.
The element that has the greatest impact on a moving average is its time span. In deciding upon the time period, you will need to examine your investment needs and interests, as well as your investment horizon. A staple among analysts for identifying long-term trends is the 200-day moving average. Shorter time periods can also be used, such as
10-, 20-, 50-, and 100-day moving averages.
If you trade on a more short-term basis, or trade in markets such as futures, 10- or 20-day moving averages would probably better suit your needs. Investors whose positions last for a longer period of time tend to use 100- or 200-day moving averages. Be aware, though, that these are just general guidelines and that each person has his own unique trading preferences. You may wish to test several different time periods until you find one that best matches your trading strategy.
Figure 1 is a chart of the Dow Jones utility index in which 20-, 50-, and 200-day moving averages have been plotted; you can see how the simple average’s period affects its representation of the data. The 200-day average is by far the flattest and, for the most part, lowest of the three averages displayed. This is because it consists of the closing values for each of the last 200 days, most of which have been lower than the current values (as is the case for a general uptrend). Note that there is little fluctuation in its movement. Longer-term averages are popular because of how well they smooth out data. Notice, too, its relatively gentle upward slope.
The 20- and 50-day moving averages are more erratic than the 200-day moving average. In addition, you can see how these two averages better “hug” the prices than the 200-day. As the time period for the average becomes smaller, the average conforms more tightly to the price data, and experiences more fluctuations.
While much emphasis is placed on the time period of a moving average, there is no consensus as to how prices should be included in an average. The debate will doubtlessly rage ad infinitum as to the optimal “window” of data to include.
If markets were truly random, the discussion as to the patterns that prices exhibit over time, and in fact the entire discussion of technical analysis, would be moot. However, if you were to pick up the price chart of almost any security, you can probably identify a regular pattern, or cycle, to its trading. The cycles cover the period from price peak to price peak.
Having said this, a popular technique to use when constructing a moving average is to fit the time period to the cycle of the market or issue you follow. The “ideal” moving average length would be one-half the length of the cycle period:
Ideal Moving Average Length =
(Cycle Length ÷ 2) + 1
As an example, look at the daily price chart for Dell Computer in Figure 2. The cycle line analytical tool in MetaStock 6.5, which allows a user to identify price cycles, showed Dell exhibiting a 22-day trading cycle for the period (illustrated by the vertical lines). Note that, while not every peak occurred every 22 days, more often than not a relative peak in price occurred near or at the cycle line. For Dell, the “ideal” moving average would be 12 days (22 ÷ 2 + 1), which is also plotted on the Dell price chart.
Another factor you must consider when calculating moving averages is the price you will use. At first, this may appear to be a straightforward decision. However, the potential for variation exists and warrants discussion. When you see a moving average, chances are, unless otherwise noted, it is calculated using the closing price of the security. The reason for this is because the closing price is where investors are comfortable holding their positions overnight.
However, variations abound when calculating price values for a specific day. Some of the more popular are (high + low) ÷ 2, (close + high + low) ÷ 3, and (open + high + low + close) ÷ 4. Figure 3 shows you four 20-day simple moving averages using the open, high, low, and close, respectively, for Black Hills Corp. Looking at these various trendlines, you can see how they form channels through which the price passes. Oftentimes, different price inputs are used to create these channels, and buy/sell decisions are made as the price passes in and out of the channels.
After deciding upon the time period and price input you are going to use for your moving average, one choice remains—which moving average to use? The most widely used averages are simple, weighted, and exponential. The differences between these averages lie with the importance that is attached to the various days’ data. In discussing these various types of moving averages, the explanations will deal solely with closing prices.
simple moving average
Simple, arithmetic, moving averages are calculated by taking the prices for a given number of periods—for example, 25 days—adding them together, and then dividing the total by the number of periods—in this case 25. Therefore, no price is given greater importance over another. The price today carries just as much weight as the price 10 days ago.
Be aware when calculating this, or any type of moving average, that you will need at least as many days of price data as the length of the average. Therefore, a 25-day moving average would require 25 days of price data in order to calculate the average.
Simple moving averages exhibit more stable behavior in an erratic market. This is mainly because they are slower to respond to a near-term increase in volatility. Therefore, they are less apt to give premature, and possibly incorrect, signals.
There are those who believe that placing equal weight on each day’s price is misleading. Their argument is that recent price activity should be of greater importance than price activity at the beginning of the average period. They point to the fact that, over time, market conditions can and do change and that current prices better represent the current trend. To this end, weighted and exponential moving averages were created.
A weighted moving average places greater emphasis on recent prices and declining importance on older data. The calculation involves multiplying each price by a weight. The value of this weight is dependent upon the number of days in the moving average. In the case of a 10-day moving average, day one’s price (the price 10 days ago) is multiplied by a weight of one, day two’s price multiplied by two, and so on, until you get to day 10’s price, which is multiplied by a weight of 10. By adding all of the products together and dividing this by the sum of the weights (1 + 2 + 3 + … + 10), you arrive at the weighted average for the selected time period (see Table 1).
The exponential, or exponentially weighted, moving average is calculated by taking a percentage of today’s closing price and applying it to yesterday’s moving average. Just as is the case with the weighted moving average, greater emphasis is placed on the newest price.
In calculating an exponential moving average, you must first decide on the percentage that you wish today’s closing price to have. The greater importance you place on today’s price, the greater the percentage you should choose. If you wanted to calculate a 10% exponential moving average, you would first have to take today’s closing price and multiply it by 10%. To this you would then add the product derived from multiplying yesterday’s moving average by 90% (100% – 10%). The formula would then read:
(Today’s Close × 0.10) + (Yesterday’s Moving Average × 0.90)
More generally, the formula for an exponential average is:
(Today’s Close × Exponential Percentage) + [(Yesterday’s moving Average) × (1 – Exponential Percentage)]
The exponential percentage is calculated as follows:
Percentage = 2 ÷ (Time Period + 1)
You can also arbitrarily select the weight you wish to place on the current price and the weighting you place on the prior average, but be sure the weightings add up to 1.0.
Be aware, too, that you have discretion as to the type of average you use within the calculation as well. Table 1 shows two different exponential weighted averages, one using a simple moving average and the other using a weighted average.
Whether you use a simple or weighted average in the calculation of a exponential average, the steps are still the same. You calculate the first average and multiply it by one minus the exponential percentage and add to that the next day’s price, which has been multiplied by the exponential percentage.
The expression (Time Period + 1) can also be used to calculate the number of periods of pricing data required to calculate the exponential moving average. The extra day of data is required since you must first calculate yesterday’s moving average and then implement today’s price as well. This means, for example, that if you were calculating a 25-day exponential moving average, you would need 26 days of prices.
Table 1 shows the 10-day simple, weighted, and exponential averages calculated for CenturyTel, Inc., using the closing price from the period May 3 through May 17, 1999. Looking at the results, you can see how the various averages represent the data. Both of the exponential moving averages (one using a simple average and the other using a weighted average) and the weighted average are greater than the simple average. This is because both averages place greater emphasis on the increase in CenturyTel’s price on day 10 (day 11 for the exponential average), the most recent day.
As the calculations for CenturyTel show, the difference between the various averages is not very significant for a short(er) period of time. However, when you compare the results of the averages over a longer period of time, the difference becomes more apparent, and significant.
The price chart in Figure 4 for Nike shows 200-day simple, exponential, and weighted moving averages. The first thing you should notice is that the three averages lag behind the price data—this is the reason why moving averages are called lagging indicators. Point 1 on the chart marks the end of Nike’s upward march that had gone on for the last several years (irrespective of near-term corrections such as in October–November 1996). On February 19, 1997, Nike topped out at $74.75 and began an abrupt downturn. Although exponential and weighted moving averages react more quickly to changes in price, it still took them almost two months (April 4) to start their downward trend at point 2. At this point, Nike had already shed 18% off its February high. Almost six months to the day after Nike reversed its uptrend, the simple moving average registered its own reversal (point 3). Aided by the short-term rise in the stock price, Nike was off “only” 20% from its high.
Just as moving averages are slow to react to the reversal of uptrends, they also are slow to announce the reversal of a downtrend. Nike bottomed out on September 4, 1998, at $33.50 (point 4), yet it took almost five months for the averages to react, at which point they reversed at roughly the same time at point 5. This reversal came, however, after Nike had already gained 25%.
These examples may appear to stand as a harsh condemnation of moving averages. But they illustrate an important point—moving averages serve to tell us what prices have already done, not what they will do. When you look at a moving average, you can see if prices, over a given time period, have risen or fallen—nothing more, nothing less. Although altering the length of a moving average will impact how quickly it will respond to a change in price, it will always be reacting.
Keep in mind, however, that all technical indicators rely on events that have already occurred—namely historical prices and volume. The advantage of moving averages is that they are relatively easy to calculate and implement in a systematic trading strategy, which will be the focus of my next Technical Analysis article in the October 1999 AAII Journal.