The following article is **an introduction to moving averages** for those new to technical analysis. After trend lines, moving averages are probably the best known of the tools used by the technical analyst. This is in part due to the fact that their concept is easily understood by the novice trader or investor and also because their usefulness (in a trending market) can be easily demonstrated. In its basic form, a moving average is no more than a smoothening of the closing price line chart. **It is a trend following indicator** which means, firstly, that its action lags behind price action, and secondly, that its direction reveals the direction of the trend.

**Calculation of a Simple Moving Average**

A moving average is described by the number of periods being averaged (the length, or speed, of the moving average). For example, if you wanted to calculate a 10 day moving average of the closing price of a stock, you would add up the last 10 days of closing prices, and divide by 10. That would give you your first point on the chart. To obtain the second point for the moving average line, you would drop off the 1st day and average the 2nd to 11th days. And so it goes on, the average “moving” so that the last 10 days of price are averaged.

Excel exercise: Take Last 10 days close prices of any stock and use the function =AVERAGE(*Your range*)

In practice, your charting program does these calculations and the moving average is usually plotted as a line on a price bar chart.

**Other Types of Moving Ave****rage**

A moving average can be calculated as a simple moving average or as an exponential moving average (EMA) or less commonly, as a weighted moving average. The above example is a simple moving average. An exponential moving average is calculated so as to give more weight to the later data and less weight to the earlier data. Its proponents maintain that it is a better trend following tool than a simple moving average, but other analysts argue that any advantage is marginal. For those interested, the formula for calculating an exponential moving average can be found at **page 123 of Elder – Trading for a Living.** Elder is an ardent advocate of this type of moving average.

**Whipsaws**

A word invariably used when talking about trading off moving average lines is “whipsaw”. It refers to the action of price crossing the moving average line back and forth a number of times over a short period. Thus a trader trading from the moving average line is put into and out of the market a number of times, with resultant loss and trading costs. Whipsaws are inevitable when a market ceases to trend. They can be reduced by using a longer period moving average but at the expense of a later entry or exit. Choosing the best length is a matter of judgment, experience, and experimentation.

**Prices and Periods Used**

Whilst a moving average of the closing price is the most common, it could equally be calculated using the high and the low price and this is sometimes done for particular types of analysis. The length of the period used is a matter of choice, depending on the analyst’s time frame and the market being traded. The 30 period moving average is quite popular. Fibonacci followers would no doubt favor Fibonacci numbers in their moving averages eg. 3, 5, 8, 13, 21, 34, 55 etc.

**Using Price and the Moving Average to Capture Trend Moves**

As a moving average lags price, in a downtrend price will be below the moving average line. When price moves from a downtrend to an uptrend, it will cross from below to above the moving average line. These crossovers create trading signals.

I mentioned above that the usefulness of a moving average can be demonstrated in a trending market. If you look at the chart of NIFTY later in this article, you can see that a crossover of the price and the 30-week moving average would have enabled you to capture most of the two trending moves A-B and C-D. The basic rule is that you go long when price crosses from below to above the moving average and go short when the reverse occurs. However, you can see that during the two trading ranges B-C and D-E, you would have been whipsawed in and out of the stock a number of times.

**Filters for Timing Trading Action**

If using a bar chart, it is to be noted that at critical times a bar can straddle the moving average line and that sometimes the crossing is not clear, and sometimes bars crisscross the moving average line for a number of periods. Some traders use filters to overcome this problem and do not take any action until, for example :-price has closed across the moving average line, or a whole bar has crossed the moving average line, or price has crossed the moving average for a certain period of time, or price has crossed the moving average line by a certain number of price units.

**Two Moving Averages**

One way of bringing greater certainty to the timing of trading action is to use two moving averages for the signal to act. In this case, a short average that is close to the price, and a longer average that offers a more smoothening effect on price and describes the trend of price, would be used, eg 5 and 21, 5 and 30, 13 and 34 etc. Trades are made on the crossovers of the two moving averages.

Below is a chart of NIFTY with 5 and 30-week moving averages. Crossovers of the two moving averages give a more definite signal than a crossover of the price and the 30-week moving average.

**Filters for Avoiding Whipsaws**

You will have observed from the above, that whilst moving averages give useful signals in trending markets, they give whipsaws in trading or ranging markets. So before a moving average can be relied on as a signal, the analyst must first determine whether the particular market is in a trending mode or not. If the market is not in a trending mode, it would be unprofitable to try to trade it using moving averages. Also, it would be unprofitable to take the crossing of price from below to above the moving average line as a buy signal, when the overall trend of price is down. So a trend filter should be applied.

As the direction of the moving average line reveals the direction of the trend, it can be used as its own filter. Thus if the moving average line is rising, the price is in an uptrend and you only trade from the long side and ignore signals to go short. If it is falling, the price is in a downtrend and you only trade from the short side and ignore signals to go long. If flat, the price is in a trading range and if you wish to trade in the trading range you must find some tool other than a trend following one (with the possible exception of moving average envelopes). This filter can be extended to say that a trader who is long, ignores sell signals while the slope of the moving average is up, and vice versa.

Looking again at the chart of NIFTY, if you were trading from the long side on moving average crossovers, this filter would have kept you out at the crossover at **Point A** and you would not have entered until **Point B** when the longer moving average turned up – a later entry but a safer one (and coinciding with the overcoming of a prior resistance level).

As can be seen from the chart, if you use the direction of the longest line as a filter, you are going to have later entry and exit signals, but it may save you from some whipsaws.A further useful trend filter is the three moving average filter, as to which see the next section. Other trend filters such as the Directional Movement Indicator are outside the scope of this article.

Whilst filters may reduce trading losses, it is important that the trader not relies merely on the filtered moving average signal in isolation, but consider other factors relevant to price movement, for example, price reversal signals, support and resistance zones, etc, before acting on the moving average signal.

**Three Moving Averages – Use as a ****Filter**

When using the 3 moving average model as a filter, probably the most popular is the 5, 15, 30-period moving average. Using this you would go long after Firstly, the 5 line and secondly, the 15 line, have crossed from below to above the 30 line. You would go short when the reverse occurred.

This 3 moving average model says you don’t go long until all moving averages are telling you to go long by all moving in the same direction or don’t go short until the reverse. However you would close a long position at the first cross down, that is, when the 5 crosses below the 15 and close a short position at the first cross up, that is, when the 5 crosses above the 15. This is because the 3 moving averages have ceased to be all moving in the same direction. Other periods can be used, eg 7, 14, 21 or for Fibonacci followers, 5, 13, 34 etc.

**Three Moving Averages – Clusters & Even Stacking**

Traders use the 5, 15 and 30-period moving averages (the harmonic moving averages) as a tool to warn of potential moves. When these three moving averages cluster together, the pattern is invariably followed by a strong momentum move. For a cluster signal to be valid, the price and the moving averages must be in the correct sequence. In an uptrend, the price must be above the 5 periods moving average, which must be above the 15 periods, which must be above the 30 periods. The reverse applies in a downtrend. (See diagram in the previous section).

When the lines become equidistant, the pattern is called “even stacking”, and this usually occurs after a strong trending move. With this pattern, you look for a reversal signal, when the price will come back and test sometimes the 15, and more often the 30-period line, or in instances fall much further, as can be seen in the chart of IndoMega below.

Some traders believe that for even stacking, it is useful to look at the actual moving average numbers, rather than just the position of the lines on the chart. The numbers will tell you whether even stacking is occurring. They do not have to be exactly equidistant, but fairly close. The reversal may not occur immediately. The market may continue on in the same direction for some days. One needs to look for a reversal signal after the even stacking is confirmed.

For those who do not have access to the moving average numbers, the writer believes a similar result should be achievable by overlaying a 5/15 moving average oscillator and a 15/30 moving average oscillator and looking at the crossover points.

These signals work in all markets in all time frames. They are not infallible, but once they occur, the odds are in favor of a move occurring. An important effect of following these signals is that they keep you trading with the trend.

Below is a weekly chart of IndoMega for the 6 years. Four examples of a cluster followed by a strong momentum move are marked C1, C2, C3 and C4.

E1 and E2 are examples of even stacking. E2 was followed by a testing of the 30 line before a final peak. Note that at E3, on the right-hand side of the chart, in September 1998, there is even stacking following a strong trending move. Prices have moved in a narrow range since late August, but it will be interesting to see whether a strong move comes out of this pattern.

These tools provide a very useful alert to the possibility of a strong move, but should not be used to try to preempt a price move, nor used as a stand alone tool.

**Multiple Moving Averages**

Devised by Darryl Guppy, these consist of a series of short-term EMA’s and a series of long-term EMA’s. Darryl uses 3, 5, 7, 10, 15 for the short term and 30, 35, 40, 50, 60 for the long term. Convergence and divergence of the EMA lines and the relationship between the long and short-term series of EMA’s give trading signals. For a discussion of these see Darryl’s article in the July issue of our Journal.

**Moving Average Line As Support**

Some traders use the moving average line as a support line, that is, when the price drops to the moving average line, go long provided the moving average line is sloping up. The reverse applies in a downtrend. This concept can work quite well. An extension of this idea is the moving average envelope.

**Moving Average Envelope**

This is calculated so that the lines are a certain percentage above and below the moving average line, eg 5% above and 5% below. The percentage chosen is that which places the major portion of the price action inside the envelope. Some traders use the moving average envelope to determine when a price is “cheap” or “expensive” (eg buy when price is near the bottom of the envelope, don’t buy when price is near the top of the envelope), but it should be noted that in a strongly trending market, price is likely to stay in the upper part of the envelope for lengthy periods, and a trader waiting for “cheapness” on this test in such a market, may miss the major part of the move.

Some traders trade at the extremes of the envelope (eg go long or close shorts at the bottom, go short or close longs at the top). An example is shown in the chart of FactMedia hereunder. The chart is a weekly one (ie each bar represents a week of trading action) with a 150-day moving average and a 10% envelope. The reason I have used a daily instead of a weekly moving average is that it makes it easier in my charting program to get down to the daily chart to determine entry and exit points when a trade looks likely. In practice, if you were in this sort of a trade, you would be keeping a close eye on the daily chart. (In practice you would examine the daily chart to optimize any trade entry).

Possible entry points are marked “B” and possible exit points are marked “S”. However, if you were to have a look at the daily chart using your charting program, you would see that it is not that easy. Assuming you were using as a filter, that a bar must close wholly across the lower line for an entry, with an exit taken on a breach below the upper line, and you were trading only from the long side, your trades may have looked like this (assuming trades executed on the opening, the day after the signal was given):-

1995: in 17/2 @1533, out 19/4 @ 1805. You would have missed the rise to 2083 on 7/8

1996 : in 23/7 @ 1790, out 26/7 @ 1750, in 30/7 @ 1770

1997 : out 4/6 @ 2113,

1998 : in 6/1 @ 1796, out 12/1 @ 1673, in 16/1 @ 1785, out 18/5 @ 2037, in 21/8 @ 1775,

out 31/8 @ 1730, in 7/9 @ 1781, still in as at 21/10 when this article was written @ 2025.

It is apparent that there were several whipsaws, but overall traders would now be ahead roughly 60% gross or 40% net, on their original investment, assuming brokerage and other costs at 1.25% per trade, and reinvestment of the proceeds of sale, with the last sale at today’s date ($20.25). The net profit equates to about 25% per annum, calculated on time in the market. In this article, I am only considering the moving average type tools. Trading might have been further optimized by using other tools in conjunction with the moving average envelope.

**Final Points**

It is important to realize that you cannot calculate, for example, a 10-day moving average, until after the close of trading on the 10th day. So you cannot trade on a signal given by a moving average line until the day after the signal is given.

The cost of using a filter is that the trade is taken later with possible lower gain, but the benefit of using a filter is a lesser chance of a whipsaw. Similarly, the longer the moving average period, the less the chance of a whipsaw, but the later the signal.

This article has looked at trade exits from the viewpoint of the moving average line. Occasionally your technical stop may take you out of a trade whilst the moving average line is still sloping in your direction if there is a sudden sustained change in the direction of price. Or you may often find the stop being hit in the vicinity of where the moving average changes direction. Whatever trading is done, should be accompanied by stop loss placements. If you do not understand the use and placement of trading stops, do not try to trade until you do.