The moving average is one of the classic and most-reliable tools for technical analysis. A moving average simply shows the average value of a security’s price over a defined period of time. The direction of the average reflects the general trend of the security.
Although the moving average is one of the simplest technical indicators, there are variations in its calculation. For example, the moving average calculation can be based on a security’s open, high, low, close, volume or even another indicator. In addition, it can be calculated over different time periods. The longer the time period, the smoother the average. The shorter the time period, the more reactive the average.
There also are variations in the process used to calculate the average. Two of the most popular methods are the simple moving average (SMA) and the exponential moving average (EMA).
The only significant difference between the EMA and SMA is the weight assigned to the most recent data. The SMA applies equal weight to all prices in the range; the EMA applies more weight to recent prices. “Two averages” (below) shows a 20-day SMA in red and the equivalent of a 50-day EMA in blue applied to daily data of the Market Vectors Gold Miner (GDX) exchange-traded fund (ETF).
An SMA is calculated by adding the security’s price for the desired lookback period (say, five days) and dividing by the same number (in this case, five). Each day, we add the new day and drop the oldest.
For example, assume these seven daily closing prices: 101, 102, 103, 104, 105, 106, 107. On the fifth day of this sequence, the average would be (101 + 102 + 103 + 104 + 105) / 5 = 103. On the second day of this sequence, the average would be (102 + 103 + 104 + 105 + 106) / 5 = 104. On the third day of this sequence, the average would be (103 + 104 + 105 + 106 + 107) / 5 = 105. Such an average is probably too sensitive to price changes because small changes in price quickly are reflected in changes in the average.
This is where EMAs are helpful. Because EMAs emphasize more recent prices in their calculation, we can achieve a smoother average line with nearly the same level of reactivity.
EMAs are based on the most recent value of the average, the most recent raw price and a weighting multiplier. The weighting multiplier can be changed to mimic a comparable length SMA. For the initial EMA calculation, an SMA of the target length is substituted for the previous-period EMA.
First, we calculate the value of the multiplier.
Multiplier = (2 / (Time periods + 1) ) = (2 / (5 + 1) ) = 0.33
Then, we insert the multiplier value into the following EMA formula:
EMA = [Close – EMA(previous day)] x multiplier + EMA(previous day)
“Average comparison” (above) shows the values of a five-day SMA and EMA for Apple. The exponential moving average starts with the simple moving average value of 449.61 in the first calculation. After the first calculation, the EMA formula takes over. The chart of the EMA is shown in “Apple smoothie” (below).
Because the EMA gives more weight to recent price action, whipsaws are less frequent. As seen in the chart, Apple closing prices stay above the stock’s five-period EMA throughout most of the uptrend that started in January 2012.
The most popular method of interpreting a moving average is to compare the relationship between a moving average of the security’s price with the security’s price itself. A buy signal is generated when the security’s price rises above its moving average and a sell signal is generated when the security’s price falls below its moving average.
While such basic trading rules may be appealing, moving averages may be better used in a less-rigid sense. For example, they can be used to find support and resistance and trend identification.
“Look at me, MA” (below) shows an example of the S&P 500 bouncing off its 50-day SMA. The green arrows identify points of bullish reaction. The red arrows identify periods when the average provided resistance.
Trend identification generally is done with long-term averages. Perhaps the most popular application is the 200-day moving average. In general, the market is considered bullish when it is above the 200-day moving average, and bearish when it is below the 200-day moving average.
As seen in “Look at me, MA,” Microsoft broke its 200-day moving average on Sept. 29, 2012, at $30. It corrected until it reached $26, and then consolidated and started forming its base. On April 9, 2013, eight months later, Microsoft was able to close above its 200-day moving average at $29.60, initiating a big rally that hit $36 by June 5, a 20% rally in just two months.
Two moving averages can be used together to generate crossover signals. Crossovers involve one relatively short moving average and one relatively long one.
As with all moving averages, the general length of the lookback period determines the indicator’s sensitivity. A system using a five-day EMA and a 20-day EMA would be deemed short-term. A system using a 50-day SMA and a 200-day SMA would be long-term.
A bullish crossover occurs when the shorter moving average crosses above the longer moving average. A bearish crossover occurs when the shorter moving average crosses below the longer moving average. As seen in “Look at me, MA,” when the five-period EMA (red) of Caterpillar (CAT) crossed below the 20-period EMA (blue), the stock began a downtrend correction from $95 to $83.
Moving average crossovers produce relatively late signals. After all, the strategy depends on two lagging indicators. The longer the moving average periods, the greater the lag in the signals. These signals work great when a good trend takes hold. However, a moving average crossover system will produce lots of false signals in the absence of a strong trend.
As lagging indicators, all moving-average-based strategies are not intended to get you in at the exact bottom nor out at the exact top. Rather, they keep you in line with the security’s price trend by being on the right side of the bulk of the move.
Bramesh Bhandari writes at www.brameshtechanalysis.com and provides online tutoring on technical analysis. He can be reached via email at firstname.lastname@example.org.