Вы находитесь на странице: 1из 6

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J.

Millard BASIC TECHNIQUES

Moving Averages, First Principles


Dont quite understand moving averages, but think that you could benefit from using them? Heres how to understand and apply moving averages to identifying trends in stocks. By Brian J. Millard f all the technical indicators, moving averages are perhaps the most widely used and misunderstood. Incorrectly applied, as is usually the case, they may be responsible for more losses than any other indicator. Correctly applied, however, they can be the most versatile and powerful tools available. The reasons for failure? First, a poor understanding of how stock prices move, and second, a poor understanding of the properties of moving averages. It is important to note that if the user does not attempt to understand how prices move, then applying any indicator is a haphazard affair. Indicators tend to be developed by trial and error, and without a clear understanding of how they work, using them can lead to disappointing and disastrous results. standard deviation of these differences, a valuable quantity that will be discussed later. The point-to-point differences can have negative, positive, or zero (no change from the previous point) values. A plot of these daily differences over a short period can be seen in Figure 1. The vertical grids are spaced at 10-day intervals, and the vertical scale is in dollars. A sequence of changes in the same direction is indicated by the plot remaining on the same side of the zero line. A close inspection of the differences reveals that the longest such sequence occurred between June 18 and July 2, 1998, and extended to eight successive rises. The extreme peaks and troughs have no meaning other than they are the maximum changes recorded. In general, a sequence of more than 10 successive moves in the same direction in a stock almost never occurs. During this period of 191 trading days, there were 99 rises, 87 falls, and four no change. There was a slightly higher probability (52%) of a rise than there was a fall. There were 102 occasions when the change was in the same direction as the previous change and 87 occasions when it was not. There was a slightly higher probability (54%) of a change occurring in the same direction as the previous change. The preponderance of probabilities one way or the other is one of the factors that produces the overall trend in the stock price over a period. Usually, these probabilities are so close to 50% as to offer no advantage in predicting the direction of the price movement. A more thorough study of these point-to-point movements, however, uncovers the fact that the occurrence of various movements in the same direction is slightly higher than called for on a purely random basis, but this is of no help when it comes to predicting the next move. As far as the model is concerned, we can consider point-to-point movement to be purely random.

STOCK PRICE MOVEMENT


The point-to-point movement model is based partly on the one put forward by analyst J.M. Hurst a number of years ago and partly on my own research. In this model, stock movement is considered to be composed of random point-to-point movement and complex cyclic movement. Point-to-point movement is simply a generalization of the sampling interval and refers to the change between one data point and the next, such as tick-to-tick, day-to-day, and week-to-week, as well as others.

CYCLIC MOVEMENT
Besides point-to-point movement, the other component of price movement is composed of cycles of differing wavelength, magnitude, and phase. The wavelength is the distance between successive peaks or troughs, and the magnitude is the vertical distance between a peak and the next trough or a trough and the next peak. The phase is the relationship between a peak and a given starting point. It is instructive to examine just one such cycle say, the nominal 41-week cycle in IBM stock especially for investors who do not subscribe to cycle theory.

POINT-TO-POINT MOVEMENT
Point-to-point movement is easily extracted from stock data by most technical analysis programs. An indicator is usually available that will give the difference between successive points; if not, such an indicator can often be created within the program. As an alternative, stock price data can be imported into a spreadsheet and the successive differences calculated and plotted. This method is useful, since a spreadsheet function will be available to determine the

Copyright (c) Technical Analysis Inc.

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J. Millard

The nominal 41-week cycle is isolated from the weekly closing prices in IBM, as can be seen in Figure 2 by a method involving two moving averages. The point in Figure 2 is that the distance between peaks and troughs varies as we move across the plot; that is, the wavelength is constantly changing. Because of this, the expression nominal wavelength is used when referring to a particular cycle in market data, meaning the average wavelength of an individual cycle over a period. The other changing parameter is the magnitude the vertical distance from a trough to the next peak or from a peak to the next trough. The phase of the cycle might also be changing, but the effect of change in phase is to give the appearance of a change in wavelength. In this way, phase change and wavelength change can be lumped together as wavelength change. The

7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9
5/21/98

CHRISTINE MORRISON

IBM (Daily differences)

6/4/98

6/18/98

7/2/98

7/16/98

7/30/98

8/13/98

8/27/98

FIGURE 1: DAILY DIFFERENCES. The differences between one days closing price and the next is plotted for IBM stock over a four-month period.

Copyright (c) Technical Analysis Inc.

9/10/98

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J. Millard

variation in wavelength is less severe than in magnitude, and thus, the next turning point in a cycle is predictable within fairly narrow limits. Much wider limits must be applied to a prediction of magnitude. In general, cycles pass though periods when their behavior is reasonably predictable and other periods when they are less so. Many cycles are present in the movement of an individual stock, some of which may be universal to all stocks and others unique to that one. The fact that some cycles are universal to all stocks (for example, a nominal 41-week cycle can be shown to be present in all the S&P 500 stocks by using the moving average method used for IBM in Figure 2) does not necessarily mean that they will pass through peaks and troughs at the same time. They do occasionally, and it is at this point that extreme rises and falls in the market occur. It is debatable whether the market influence causes cycles to come into phase with each other. Each of these cycles will go through this variation in wavelength and magnitude, but the variation among a group of cycles of contiguous wavelengths, covering a large band of wavelengths, can often cancel each other out. As a result, the behavior of such a group is much more predictable than the behavior of an individual cycle. Now that we have a model of stock price movement, we can investigate the properties of moving averages and how these properties may be of use in the interpretation of such movement.

8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
2/11/94

IBM (41-week cycle)

10/18/96

12/12/97

8/25/95

1/12/96

5/31/96

7/25/97

9/18/98

7/1/94

4/7/95

3/7/97

5/1/98

FIGURE 2: NOMINAL 41-WEEK CYCLES. The nominal 41-week cycle is plotted for IBM since early 1994. Note the moderate variation in wavelength as measured by the horizontal successive peak-to-peak and trough-to-trough instances. The variation in magnitude as measured by the vertical successive trough-to-peak and peakto-trough distances is much more pronounced.

be reduced in the averaged data, and in some instances will be displaced in position. The various possibilities are best addressed by looking at various values of m in the relationship: Span = Where mw m = a numeric value w = wavelength

PROPERTIES OF MOVING AVERAGES


While it might seem trivial, it is important to understand the procedure by which a simple average is calculated, since then it is possible to understand the main property of an average. An average is derived from a running total calculated, for example, for an n-point average by adding up the first n data points. The running total for the next calculation is modified by adding the next data point and dropping the first. Thus, the procedure is to constantly modify the running total by adding in the (n + 1)th point (the new point) and dropping the first point (the drop point) of the total. As each running total is calculated, the corresponding average is obtained by dividing it by n. For a regular cycle one with constant wavelength, magnitude and phase, and symmetrical around a zero line we will find that if an average of span n is applied to such a cycle with wavelength also equal to n, the first value of the running total will be zero. This is because there will be a corresponding point below the zero line for every point in the wave above the zero line. For the next value of the running total, we find that the point we must add in has exactly the same value as the point we must drop. Hence, the total will remain at zero and continue to do so as we move along the wave. This will also happen when the span is an exact multiple of the wavelength. Clearly, the net result is that such cycles will be completely absent in the resulting averaged data (the output). What happens if the span of the average is not the same as the wavelength? In such cases, the magnitude of cycle will

When m is an exact integer, the cycle will be completely removed from the output. When m is less than 1, the magnitude of the cycle will be reduced in the output. The phase of the output (positions of peaks and troughs) will be identical to that of the original cycle. As m decreases, the amount of reduction decreases.

The running total is constructed by adding in the new point and subtracting the drop point. The total is then divided by n, the span.
Where m lies between an even value of m and the next odd value of m, the output will remain in phase with the original. The magnitude will be reduced, the amount of reduction falling to a minimum and then rising as m moves between the two extremes. Where m lies between an odd value of m and the next even value of m, the phase of the output will be shifted by half a wavelength from the original. The magnitude will be reduced, the amount of reduction falling to a minimum and then rising again as m moves between the two extremes.

CHANGE IN VALUE
The running total is constructed by adding in the new point and subtracting the drop point. The total is then divided by n, the span. Thus, the change in the average from its previous calculated value depends on the difference between the new

Copyright (c) Technical Analysis Inc.

11/18/94

2/5/99

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J. Millard

11 10 9 8 7 6 5 4 3 2 1 0 -1

70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30
12/8/94

AT&T (daily)

4/27/95

9/14/95

6/20/96

11/7/96

3/27/97

8/14/97

5/21/98

10/8/98
10/8/98

FIGURE 3: APPLICATION OF AVERAGES TO CYCLIC DATA. The solid sine wave is a regular cycle of wavelength of 51 weeks. The solid horizontal line at the $5 level is the output from a 51-week average. The dashed waveform with peaks and troughs aligned with the original sine wave is the output from the 31-week average. The dashed waveform with peaks and troughs out of phase with the original sine wave is the output from a 75-week average.

FIGURE 4: NONLAGGED AVERAGES. The smooth line is the output from a 201-day average plotted with no lag. The relationship between the data and the average is not obvious.

point and the drop point and also on the value of the span of the average. For any given difference between the new point and the drop point, the change in the average will obviously decrease as we increase the span, because we are dividing the total by increasingly larger numbers. On the other hand, for any given span, the change in the average will increase as the difference between the drop point and the new point increases. In real terms, a kink will appear in the averaged data not only if there is a spike, a large change in the data at the position of the new point, but also if there is a spike in the historical data at the position of the drop point. If there is a spike in both positions, the average will be doubly affected if these spikes are in opposite directions. If they are in the same direction, the kink will be greatly reduced or even absent.
70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30
12/8/94

APPLICATION OF
AN AVERAGE Point-to-point movement: Simply, the isolated point-to-point movement can be considered to be truly random. In such a case, the difference between two points is independent of their distance apart in time and is simply a random value. Thus, the difference between a drop point and the new point is chance. The only factor with an effect in reducing movement in the averaged data is the span used for the average; the greater the span, the greater the reduction. The movement will never be quite eliminated, but it will become unimportant once we reach spans of 50 or greater. On those occasions where the drop point is an extreme one, and the new point is also extreme but in the opposite manner, then there will still be a
70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30
12/8/94

AT&T (daily)

AT&T (daily)

4/27/95

9/14/95

6/20/96

11/7/96

3/27/97

8/14/97

5/21/98

4/27/95

9/14/95

6/20/96

3/27/97

8/14/97

5/21/98

10/8/98

FIGURE 5: CENTERED AVERAGES. The smooth line is the output from a 201-day average plotted as a centered average, lagging by 100 days. The average can be seen as a representation of the longer-term trend.

2/25/99

FIGURE 6: ERROR IN NONLAGGED AVERAGES. Both the unlagged and centered averages are plotted on the same chart. The first two double-headed arrows show where the direction of the unlagged average is opposite to the true direction of the trend. These are the places where methods based on unlagged averages are likely to be in error. The third arrow in mid-1998 indicates a period when the direction of the trend is yet to be established.

Copyright (c) Technical Analysis Inc.

2/25/99

2/1/96

11/7/96

2/1/96

1/1/98

1/1/98

2/25/99

2/1/96

1/1/98

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J. Millard

kink in the resulting average, taking even larger spans to reduce to an unimportant level. If the random point-to-point movement is not isolated but present in addition to the mixture of cycles, as is the case with real stock market data, then we do not need such large spans for the average to appear to eliminate this movement. It will only represent a proportion of the total movement, and the averaged data will have larger positive values due to the cyclic data present, making the averaged random movement appear insignificant. The smaller the proportion of random movement in the total data, the smaller the span required to reduce it to apparent insignificance; extreme values of the drop point and the new point will still leave a kink in the averaged data. Nine points or less will usually suffice to smooth out the point-topoint movement. We can use the value of standard deviation mentioned previously to give us an idea of the proportion of stock price movement due to randomness. Statistically, 95.5% of the random movement will be contained within two standard deviations either side of the mean, so four times the standard deviation is due to this random movement. Dividing this by the latest stock price gives us an estimate of the proportion of random point-to-point movement in that stock. For IBM , this amounted to about 7.7% in October 1998. This does not include the random variation in the magnitude of the cycles present. Cyclic movement in stocks: As we have seen for IBM, cycles in real stock market data are not regular, since they change randomly in wavelength and magnitude. The property of an average that removes a cycle of the same wavelength or multiple thereof will not apply. However, the property of reducing the contribution of cycles of wavelengths greater or lesser than the span will still apply, and this is what makes moving averages so valuable. Once we move above spans of about 9 points, there will be a marked reduction of the point-to-point movement and of those cycles whose wavelength is less than the span of the average. Wavelengths longer than the span of the average are most relevant. Roughly, cycles with wavelengths about 1.5 times the span of the average will be reduced by about 70%, while those with twice the span will be reduced by about 50%, but those four times the span will be reduced by only 10%. The main effect of applying an average to stock market data is to remove random point-to-point movement and reduce cycles whose wavelengths are less than about twice that of the span of the average. All this works to leave us with a fairly smooth average whose shape is mainly due to the combination of all those wavelength cycles greater than about twice the span of the average.

in chartist techniques that it is no longer possible to eradicate it. However, the properties of moving averages we have discussed assume that averages are presented as centered. We can demonstrate the advantages of centered averages over unlagged averages by referring to two charts. The plot of a 201-day average in the usual chartist mode can be seen in Figure 4, while in Figure 5 the average is plotted as a centered average. A centered average of span n is set back in time by:
(n - 1)/2 points

CENTERED AVERAGES
One of the major reasons that moving average methods fail is that the averages are usually plotted with no lag; that is, they are not centered. The use of unlagged averages is so ingrained

We use 201 rather than 200 days to give a lag that is an integer (100, in this case), allowing us to center the average at the position of a data point and not between two such points. Plotting averages as in Figure 4 is only useful if the crossing of the average by the data, or the crossing of two averages, has some meaning. Plotting them as centered averages as in Figure 5 has two main advantages. First, the average is a better representation of the data, since short-term fluctuations and random day-to-day movement have been almost totally removed. What is left is the net effect of all those cycles of wavelength greater than about 400 days. Thus, a centered average is representative of a trend, which can be considered to be the long-term trend. A nonlagged average, on the other hand, is in the wrong position to be considered to be a trend, even though its shape is identical to that of the centered average. The second and perhaps the most vital point concerns the lag in the average, which in this case is 100 days. We do not know how this average moved during this period, and because we now consider the centered average as representing the trend, we do not know what the trend has been doing. This is something that we will discover only when we make new calculations over the next 100 days into the future. This point is the source of disappointment when nonlagged averages are used as a guide for trading decisions. The actual trend could well have changed direction during this period, so decisions that assume that the trend is still rising because the average was still rising at the last calculation can go disastrously wrong. This point can be illustrated by plotting both the nonlagged and centered averages on the same chart, as seen in Figure 6. There are two places where the trend, as indicated by the centered average, is going in the direction opposite to that of the nonlagged average. These are marked by the first two double-headed arrows. The third, latest, arrow is at a point where we do not know what the current trend is doing, so the trend might be going in the direction opposite to that indicated by the nonlagged average. It is at these turning points that decisions based on nonlagged averages will come to grief. Because the centered average is lagging by half of a span 100 days we have two places in the plot where the nonlagged average is in error for 100 days a total of 200 days out of 860, covering the period of the plot up to

Copyright (c) Technical Analysis Inc.

Stocks & Commodities V17:2 (101-106): Moving Averages, First Principles by Brian J. Millard

the last position of the centered average. In addition, we have a third place where the unlagged average will be in error if the trend changed direction in mid-1998, although this has yet to be established. Thus, for at least 25% of the time, the nonlagged average indicates an incorrect direction for the long-term trend. In those stocks with more frequent turning points, the position will be even worse. This is unfortunate, because just when the investor is most in need of help in deciding whether a trend has changed direction is the time when the nonlagged average is giving the wrong answer. However, there are ways in which an estimation of the trend direction and whether it has changed can be improved, and these will be discussed in another article.

as channel analysis. My next article will show how the short-term fluctuations that still appear in the output of simple averages can be removed by applying a second average or a weighted average. I will also look at the use of the difference between two averages and the difference between the average and the data for investigating individual cycles and groups of cycles. Brian Millard is the author of six books on technical analysis, including Profitable Charting Techniques, Channel Analysis and Channels And Cycles.

RELATED READING
Hurst, J.M. [1970]. Profit Magic of Stock Transaction Timing, Prentice-Hall. Millard, Brian J. [1997]. Channel Analysis, second edition, John Wiley & Sons. _____ [1999]. Channels And Cycles: A Tribute To J.M. Hurst, Traders Press. _____ [1997]. Profitable Charting Techniques, second edition, John Wiley & Sons.
See Traders Glossary for definition
S&C

FURTHER APPLICATIONS
Another point should be noted when a centered average is plotted. From Figure 5, it can be seen that the excursions of the data on either side of the average line are limited. When a maximum distance is reached, the data reverses direction. Boundaries can be drawn to contain this movement, leading to the powerful predictive technique known

Copyright (c) Technical Analysis Inc.

Вам также может понравиться