I became more interested in moving averages when I was looking into developing a trend-following system, since moving averages help identify trend reversals. Therefore, I took a closer look at the differences between the different types of moving averages and the possible benefits of using one versus another.
For those of you new to trading, trend-following strategies target larger price movements in one direction, as the name implies. For example, a good trend-following trade would have been shorting a major stock index in October 2008 and exiting the trade sometime early 2009. Usually trend-following strategies imply keeping a trade open overnight. The length of the trade could vary from a couple of days to a few months because trends can vary in length. Trends are readily divided into three categories: primary trends (between 9 months and 2 years), intermediate (between 6 weeks and 9 months) and short term (typically from 2 to 4 weeks). I will show you how I was able to “capture” one of the shortest trends.
As I was playing around with different moving averages, I started paying more attention to how they respond to price changes, basically to their sensitivity to such changes and also reliability of trading signals. The idea was to buy the stock if the short term moving average crossed above the longer term moving average, such as a 10-day simple moving average (SMA) cross above a 20-day SMA. A sell signal meant that the 10-day SMA crossed below a 20-day SMA. I asked myself if I should use a cross of simple moving averages or a different combination, such as a SMA with a weighted moving average (WMA) or an exponential moving average (EMA). My objective was to develop a system that alerted me quickly enough about the beginning of a trend, but still eliminated the false signals associated with “whipsaws” or “non-trendy price movements.”
WMA and EMA: Similarities and Differences
First of all, let’s start with similarities: they are both weighted moving averages, unlike the simple moving average, which treats all data indiscriminately. A simple moving average is constructed by summing the closing values and dividing the sum by the number of periods. Closing prices are used in the calculation of moving averages because they are considered more reliable than openings, heights or lows, since they reveal the price at which traders are willing to carry a position overnight. The SMA is the most reliable of the moving averages and some of the advantages of using simple moving average crosses is to pinpoint potential trend changes and receive objective entry and exit trading signals. However, one of the disadvantages of simple moving averages is the fact that the signal could be delayed, since the SMA distributes the same weight to all periods, no matter how old they are, and therefore it may not react timely enough to directional changes.
One method that attempts to overcome the weakness of SMA is to weight the data in favour of more recent observations. The weighted moving average tries to solve this shortcoming. The most common technique used to built weighted moving average is to multiply the first period by 1, the second period by 2, the third period by 3, and so on. The next step is to sum the calculations. The third step is to sum the weights and finally, the last step is to divide the second step by the third’s step value. As a result, WMA is more sensitive to price changes than SMA.
During times when most trading days have similar trading ranges (the absolute value between the opening less the closing price), the weighted and simple moving average work just fine. However, if the last 20 days have a significantly different range than the day preceding them, omitting that 21st day from calculations does not paint an accurate picture, therefore making the practice of dumping older data detrimental. This is why both WMA and SMA have a common weakness: they do not take into consideration the oldest data. The exponential moving average (EMA) addresses this issue as well as weighting the data issue, making the EMA a hybrid between SMA and WMA.
Calculating EMA by hand is somewhat cumbersome, but luckily the trading software does it for you; you only need to specify the length of the period: 10, 18, 25, etc. FGL’s chart below shows how the 20-day EMA (the blue line) tracks the price changes closer than the stock’s 20-day SMA.
It is worth knowing the logic behind moving averages since they are also used as foundations for other indicators and oscillators, such as McClellan Index and MACD (moving average convergence divergence) or Bollinger Bands.
Going back to my trend-following system, I noticed that a combination of a 10-day SMA and a 20-day EMA provided reasonable buy and sell trading signals (please see chart below).
Other Considerations for Moving Averages
When plotting an MA on a chart you can notice that a security’s price from time to time crosses the MA, either above or below. It is important to observe (please see chart below) that not all crossovers are valid, meaning that not all of them signal a trend change. This is why allowing some room for error may be a good idea. In practice this can be accomplished by waiting till the closing of the trading session before making any decisions and observing if the crossing still holds. Another filtering technique is to create a range around the moving average. For example, if a stock varies from its MA at the closing of the day by 1%, then the crossover is considered valid. Another filter could be that the crossover has to be in place for more than one trading session before reacting on this information. Lastly, a combination of all of those three filters can be used to separate wheat from the chaff, metaphorically speaking. However, it is noteworthy to mention that a reversal in the direction of the MA is more reliable than a crossover. Also, a crossover of a 10-month average is more significant than a crossover of a 25-day average. Unfortunately, given their lagging nature, moving averages tend to reverse after the old trend stopped. The chart below illustrates how moving averages crossovers work and sometimes do not work, please see the last buy and sell signals.
We established why closing data is the data of preference when constructing moving averages, but the question remains: how much data should you use? Whatever time span is used is significant, since a moving average that is too short is not going to filter out the whipsaws or the noise, and a moving average that is too long does not provide enough trading signals. Both extremes are pointless for trading purposes. In general, the length of the moving average depends on the type of trend and the stock’s characteristics; nevertheless, neither of the moving averages are bullet proof. Normally, for shorter-term trends, 10, 25, 30 and 50-day spans are advised, but for longer time spans, 40-week SMAs and 65-week EMA averages are advocated. When using monthly data, 6, 9, 12, 18 and 24-month moving averages are more reliable. Martin J Pring, renowned technical analyst and author observed, “There is no such thing as a perfect average. The choice of time span always represents a trade-off between timeliness (catching the trend at an early stage) and sensitivity (catching a trend turn too early and causing an excessive number of whipsaws)."
Although not as popular and easy to understand as SMAs, EMAs and WMAs are capable of compensating for the SMA’s shortcomings and providing a good foundation for the popular Bollinger Bands and MACD.
>> BACK TO THE NEWSLETTER: Click here to read other articles from this week's newsletter