Trend Following Indicators: Moving Averages
Trend Following Indicators: Moving Averages
We now introduce a range of trend following indicators. While indicators are partly an attempt to
get away from the subjectivity of classical charting, some also introduce new concepts.
We discuss several trend following indicators, starting with moving averages and progressing to the
more sophisticated approaches Parabolic Time/Price System and Directional Movement Indicator.
All of these indicators are attempts to define trend in an objective way.
Moving Averages
The calculation of moving averages was dealt with in the article Introduction to Indicators and should
be read before tackling the material below.
Analysis and trading using moving averages may be carried out using one moving average line or
several moving average lines in combination. We will first outline how a single moving average is
used. Later, we will look at how two or three moving average lines can be used.
The basic use of a single moving average is based on the idea that, in an uptrend, the moving
average tends to lag the price, so that price is above the moving average. When the uptrend ends
and a downtrend begins, price will tend to move to below a lagging moving average.
• Go long when price crosses from below to above the moving average
• Go short when price crosses from above to below the moving average.
The diagram below shows the basic trading rules for a single moving average:
The chart below shows a long (150 days) moving average over more than a complete market cycle
on a stock chart:
It will be noticed that there were some violations of the moving average in the long trading range at
the bottom of the chart. Using the trading rules, this would have involved losing trades. This chart
highlights one of the most important rules for use of indicators: Trend following indicators, which
moving averages are, are most effective when used in trending markets and are ineffective in
trading ranges. We will discuss this aspect again later.
Another alternative, which is used by most analysts and traders, is to run the moving average over a
bar chart of the instrument. When we introduce a bar chart, we encounter a problem that was not
apparent on the line chart. On the line chart, the price line either crossed the moving average or it
did not in any time period. However, with the bar chart, the bars may sit across the moving average.
Since our trading rule is to open and close trades as price crosses the moving average, the use of a
bar chart introduces some uncertainty. The chart below is for the same share in the chart above,
except that the bar chart has been substituted for the line chart of the closing price:
What the bar chart has introduced is the idea of intraday violations of the moving average. The line
chart of the closing price ignored intraday price activity and only considered the price once a day
when the market closed. It ignored the intraday fluctuations that are introduced when the bar chart
is used.
There are two basic ways that technical analysts and traders deal with this problem:
• They vary the time window of the moving average so that the violations are confined to
those that are significant. The time window is the number of days used in the moving
average calculation.
• They introduce modifications to the trading rules in the form of filters. These are simply
additional conditions that have to be satisfied to signal a trade.
In the next two sections, we will explore these approaches to the problem in more detail.
This approach suffers the problem that a moving average will work well in one trend, but not in the
next trend. In the chart below, we have taken another period in the same stock and applied the
same moving average time window as we used in in the chart above:
The reason that we got this result is that trends vary in speed and volatility. Speed is the steepness
of the price line, or how quickly the price rises or falls. Volatility is the degree to which price swings
up and down around the basic trend direction. In general terms, the faster the trend and the smaller
the volatility, the better a moving average will work as a trading tool. This can be easily seen in the
chart before last above.
In that chart, we eliminated inappropriate violations for a particular trend by carefully selecting a
moving average time period to suit it. However, this was using a line chart of the closing price. As we
have already seen, substituting a bar chart in place of the line chart will introduce temporary
violations during the trend, as shown in in the chart below:
The above chart and the one below can be used to show that varying the moving average time
window is not always a solution to the problem of temporary violations of the moving average. If we
adjust the moving average time window to eliminate the temporary violations in the chart above, we
might find the picture like the chart below:
It is therefore a trade-off between false signals and late signals. The general rule is: the longer the
time outlook, the slower should be the average. The trade-off is as follows:
Advantage Disadvantage
Short time frame More responsive to price More whipsaws
Long time frame Less whipsaws Late signals
Since trends vary in speed and volatility all the time, finding the optimal time window for a moving
average can only be done with hindsight. The way technical analysts try to deal with this problem is
to test varying time windows over lots of markets and time periods and find a time window that
works well most of the time. Then they try to further minimise the inappropriate signals using filters.
However, there is an important caveat about such an approach. There is a temptation to take such
testing over past data too far. This occurs when the analyst takes a specific period for a single market
and tests all the time windows to find the best one. This is called “curve fitting” in trading system
parlance. The problem is that the future is never exactly like to past. What the system builder needs
to find is a time window that works well over lots of markets, over different time periods and over all
sorts of market conditions. Such a time window is called a “robust” parameter, because one of its
Entire Bar: An entire trading session must trade on the other side of the moving average.
Percentage: Price must cross the moving average by a certain percentage of the price or of the
moving average.
Price Units: Price must cross the moving average by a certain number of price units.
Time: Price must cross the moving average for a certain time period.
There are also combinations of these filters, such as requiring price to close across the moving
average for two bars and so on.
The moving average is a trend following indicator. This means that we use it to follow the trend. All
we are doing is smoothing the price so that we can better see the trend. Accordingly, there are three
possible trend situations:
So, we use the direction of the moving average line as a filter by:
• Only being long when the moving average line is moving up.
• Only being short when the moving average line is moving down.
This introduces the idea of being out of the market when the moving average line is flat. When it is
flat, it is not trending.
However, it is important to understand that the direction of the line is not used by itself, it is used
only as a filter on the crossover of price and the moving average.
• Go long when price crosses from below to above a rising moving average. Close the long
trade when price crosses from above to below the moving average.
• Go short when price crosses from above to below a falling moving average. Close the short
trade when price crosses from below to above the moving average.
Essentially, trend following indicators should not be used in non-trending markets. Momentum
oscillators, which we deal with in the next article, are more suitable for trading in sideways markets.
The chart above shows a daily bar chart a 10-day simple moving average.
We start with price above a falling moving average. On October 1, price crosses to below a falling
moving average, so we go short the next day. However, on October 3, price cuts to above a moving
average that has now begun to rise. We go long the next day. Note that on that day, the moving
October 10 is a problem as the market opened below the moving average. However, it closed
strongly above it. (We could also have used a closing price filter to deal with this.) Price then stays
comfortably above the moving average until October 29 when it cuts to below the line. We close our
long position the next day, but do not go short, because the moving average is still rising.
November 1 is a difficult day, because the moving average has turned down, but price spent some of
the day above it. Had we been tempted to go short, we should not have done so when the next day
opened and traded clearly above the moving average. In fact, November 4 is a signal to go long again
as price has crossed to above the now rising moving average.
We go long again the next day. We stay long until price cuts down through the moving average on
November 11. We close our long position the next day, but do not go short as the moving average is
flat on November 11. Although price then stays below the moving average for the following three
days, we do not go short as the moving average is still rising. The very last bar on the chart signals us
to go long again as price cuts up through a rising moving average.
That is how we apply the rules, but astute students will notice that from late October onward, we
were really in a trading range. True there was an upward bias and this caused the moving average to
continue to rise gently. However, the slope of the line is less than it was in the earlier strongly
trending phase. This poses the problem of ‘how flat does the moving average have to be?’ We have
clear rules that are objective but the best result might have been to introduce some subjectivity —
an excellent example of how technical analysis is part science, but requires some art to be most
effective. Art, in this context, is another way of saying “experience”.
Now it is true that, in extreme cases, we will know roughly where the moving average will be and it
is always possible to make a ‘what if’ calculation. More importantly, situations will arise when we go
to make a trade on the next day and price has obviously gapped back across the moving average on
the open. Common sense suggests that some reassessment is prudent, prior to mechanically
following the signals in these situations.
Whether it be a moving average, or any other indicator, when analysing what we should have done
in the past, do not fall into the trap of making impossible trades. This happens most often when we
act on a signal during a day when the signal is not generated until the closing price is known. This
kind of mistake can be very dangerous, as it can lead to thinking that a trading methodology might
have been more profitable than it actually would have been.
The first thing to be decided is the time window for the fast moving average. The fastest possible
moving average is a one period average. This is no use, because a one period moving average line is
the same as a line chart of the closing price. The line we want needs to be slower than that. There
are several ways to choose a time window for the fast moving average. Whichever method is used,
the line chosen should smooth the line chart of the close and also describe the trend of the closing
price fairly faithfully. A common speed for the fast moving average is five days as this tends to meet
the above criteria and also represents a short cycle — the trading week.
The chart below shows how a five day moving average closely follows price, only moving outside the
daily range in fast-trending sections of the chart:
To see how this five day moving average line smooths the closing price line, observe the chart below
where the smoother of the two lines is the moving average:
The rules for using the ‘two moving average’ indicator are derived from the discussion on using a
single moving average, except that the fast moving average is used instead of price:
• A signal to go long is given when the fast moving average crosses from below to above the
slower moving average.
• A signal to go short is given when the fast moving average crosses from above to below the
slower moving average.
Notice how, as in the single moving average discussion, good profits are made in trending sections of
the chart, but results are poor when a trading range develops.
The particular example we have used would have captured the shorter term trends, both up and
down. However, it is also obvious that there was also a medium term downtrend overall. The ‘two
moving average’ approach could be used to trade this trend also, by substituting for the twenty one
day moving average a more appropriate moving average, say a 63 day moving average, which
represents the quarterly reporting cycle:
The signals are given when the oscillator crosses the zero line: when the oscillator crosses above
zero, we buy, and when it crosses below zero, we sell.
The moving average oscillator is used so that the price area of the chart remains relatively
uncluttered as shown in the chart below:
In selecting time windows for the three moving averages, analysts have resort to varying
approaches, such as:
• Use three consecutive cycle lengths, e.g. 5 days to represent the weekly cycle, 21 days to
represent the monthly cycle and 63 days to represent the quarterly reporting cycle.
• Use so-called ‘harmonic’ numbers, e.g. if the major cycle is 30 days, use 30 days (major
cycle), 15 days (second harmonic) and 5 days (sixth harmonic).
• Use Fibonacci numbers, e.g. the early part of the Fibonacci series is 1, 1, 2, 3, 5, 8, 13, 21,
34, 55. The analyst might use 5 days, 13 days and 34 days.
• Use other combinations based, perhaps, on exhaustive testing over past data of many
markets. Care needs to be taken not to ‘optimise’ the combination so that it only works on a
specific set of past data — so-called ‘curve fitting’.
The diagram below shows entry rules for trading with three moving averages:
When the moving averages are not in one of these two configurations, we remain out of the market,
or trade it using tools other than trend following indicators.
The diagram below shows exit rules for trading with three moving averages:
The diagram below shows trading rules for three moving averages:
In the two charts below, we see how this works in a stock chart. The top chart shows a bar chart of
the price. The lower chart shows the three harmonic moving averages 5, 15 and 30 days. The trading
signals generated by the above rules are marked on the chart by S = Go short, L = Go long C = Close
trade:
• The system assumes that we are trading a trend and therefore expect price to move over
time. Therefore, the stops generated are driven by an acceleration factor based on the time
elapsed.
• This acceleration factor means that the stops trace out a pattern like a parabola.
If you are long, the system will move the stop up every day, regardless of whether price has moved.
This is the time function. The system also has a price function in that how far the stop is moved up
will depend upon the extent to which price moves up.
The Parabolic is also known as an SAR system — Stop And Reverse — which means that when the
system dictates the closing of a trade, another trade is opened in the reverse direction. In other
words, we move from long to short and short to long without a period out of the market. This is
similar to the one or two moving averages approach and suffers the same problems when price is in
a trading range.
Calculating Parabolic
Calculation of the Parabolic stops is possible by hand, but as a computer will be used in practice, we
will not go into the intricacies of the process here. However, it is important to understand the
features of this system and how to use it.
Using Parabolic
While the Parabolic looks superficially like a moving average, it is quite different. Parabolic plots
stops — price levels which, if hit, are signals to close the trade and take a new trade in the opposite
direction. Another key difference is that the Parabolic stop is calculated for the next day, not the last
day. In this way it is truly a stop loss level.
A position is opened when price hits the Parabolic stop level. The stop for the day the trade is
opened is the extreme point reached in the last trend (the high for an uptrend or the low for a
downtrend). Thereafter, the Parabolic stop moves up in an uptrend, or down in a downtrend,
following price in an accelerating pattern generated by the formula.
In the chart below, the Parabolic stop levels for each day are shown as a series of dots above or
below the price bars.
A feature of the Parabolic is that it is excellent in fast moving trends, because it is constructed with
the basic assumption that the trend will continue and accelerates the stop as it does so, locking in
profits. The Parabolic is probably the best way to set stops in a dynamic trend, where there are few
conventional support levels on which to base a stop.
The chart below shows both the strength and weakness of Parabolic:
Its weakness was exhibited in the previous two months as price traded in a narrow trading range.
Like all trend following indicators, Parabolic was useless in the absence of a trend.
Parabolic can be used in any time frame. Indeed, it is important to match the time frame of the chart
to your trading horizon.
In the chart below we see Parabolic, on a substantial medium-term uptrend on a daily chart. While
this would have suited a short-term trader who wished to trade short swings within the uptrend, it
would not suit a longer term trader who wished to capture the medium-term trend.
The Directional Movement System is the most complex of the trend following indicators we are
dealing with here. Although we will not go into all of the details of its calculation, it is necessary to
understand some of the concepts that are involved in its formulation.
• Direction
• Movement.
For this indicator, we want to determine the direction and then measure the movement.
We decide what the direction is by determining whether the larger part of today’s range is above or
below yesterday’s range. If it is above, we call it +DM and if it is below, we call it –DM. This diagram
shows this idea visually:
Limit days in futures markets are treated the same as for gaps.
True range is always a positive number. Limit days in futures markets are treated the same as for
gaps.
–DI does not mean DM is a negative number in the equation; it just describes the direction of the
movement.
Remember, we cannot have a +DM and a –DM for the same day.
What we have calculated is what percentage of the true range movement on an up day was +DM
and what percentage of the movement on a down day was –DM.
In order to use the Directional Indicator, we need to smooth it over a period — say 14 days as used
by its originator J. Welles Wilder. Without going into the mathematics, this is done by using a
smoothed moving average, which also happens to make its calculation by hand easier than a simple
moving average.
–DI = 40%
If we add these percentages together, we determine the average percentage of the true range that
was directional during the last 14 days.
This means, of course, that the rest of the true range for the last 14 days was non-directional.
Where this is useful is to realise that the true directional movement is the difference between +DI
and –DI. That is, the true directional movement is the difference between the up directional
movement and the down directional movement.
This can be expressed another way — the greater the difference between +DI and –DI, the more
directional the movement of the instrument being analysed.
• Price rises for 14 consecutive days. This would tend to mean that +DI would be a large
percentage and –DI would be close to zero. Therefore in this very directional market, the
difference between +DI and –DI would be large.
• Price falls for 14 consecutive days. Here, –DI would be a large percentage and +DI would be
a near zero — the difference between them in this very directional market would be large.
• Price fluctuates over the 14 days, making little overall progress. Here +DI and –DI would
have similar values and the difference between them in this non-directional market would
be small.
The directionality of the market can be expressed as what Welles Wilder called the Directional
Movement Index (DX):
DX = (Difference between +DI and –DI) ÷ (+DI plus –DI)
This equation expresses the directionality of the market (DX) as being the ratio of the net directional
movement to the directional true range over the last 14 days. This ratio is expressed as a percentage
and is always a positive number. The higher the DX the greater the directionality of the market.
It does not matter whether this directional movement is up or down. A high DX means a very
directional market — either up or down.
Thus, if price rises for 50 days and then falls for 50 days, the DX will rise, then top out and start down
as the price begins to fall. However, as the price continues to fall, DX will start to increase again, i.e.
as the trend in price turns from up to down, the difference between +DI and –DI will fall and then
rise again.
The final step in the Directional Movement System is to calculate the average directional movement
index (ADX) which is achieved by smoothing the DX by taking a 14 day moving average of DX.
• +DI
• –DI
• ADX
The above chart is labelled, but take a few moments to observe the above characteristics.
While these two rules are sometimes used on their own, three additional rules are needed to avoid
whipsaws in trading ranges:
• Only take these signals when the ADX turns up from below both DI lines. This is based on the
observation that the best trends emerge out of dull markets (trading ranges).
• The extreme point on the day the DI lines cross should be used as a stop loss level even if the
DI lines cross against your position for several days. The extreme point if +DI rises above –DI
is the low of the day of the crossing. The extreme point if –DI rises above +DI is the high of
Other ways to use Directional Movement can be found in the literature. The above seem to be the
most solid of them based on Welles Wilder’s original work. Let us now look at these rules in practice.
In the chart above, we see some crossovers of the DI lines in February, but ADX is falling or flat, so
we pass them up. In March, we reach day A, where –DI is above +DI and ADX turns up from below
the DI lines, so we would go short.
At day B in April, –DI falls below +DI so we close our short trade. However, we do not go long
because ADX is falling. We have to wait for day C when ADX turns up again to go long.
In May at day D, +DI falls below –DI, but we would have closed the trade a few days earlier when
ADX turned down, even though it was not above both DI lines. We would not go short at day D,
because ADX is falling. With hindsight, this would have been a good point to go short. ADX often
gives late signals when trends reverse abruptly. Many analysts would take the short trade because
the need for ADX to turn up from below both ADX lines is a conservative rule trying to filter out all
but the best trends.
Note: The extreme point rule would have dictated that we hold our short position during the
whipsaws in late May.
We would have taken profits at day F in July as ADX turned down from above both DI lines. More
profits would be taken at day G for the same reason.
All short positions would be closed at day H as –DI fell below +DI.
In early August, a new long position might be opened as +DI rises above –DI. However, ADX is falling,
so the conservative approach is to await a stronger ADX, which turns up, but between rather than
below the DI lines.
The way Welles Wilder designed the directional movement system, it led into another indicator
called the ‘Commodity Selection Index’ (CSI). This indicator is beyond the scope of the present
discussion. However, the link between CSI and directional movement was ADXR, which he used to
rate all commodities, currencies and stocks on a scale ‘indicating how directional their movement is’.
The idea was to trade those securities which show the most directional movement.
ADXR can also be used to decide for an individual market, whether movement is sufficiently
directional to be worth trading. In short: whether it is trending strongly enough to trade with trend
following tools.
Welles Wilder’s rules were that the directional movement system will only be profitable if ADXR is
above 25 and when ADXR drops below 20, trend following indicators should not be used.
Today, many analysts do not bother to calculate ADXR and instead simply use the value of ADX on
the basis that a market is trending sufficiently to trade when ADX is above 25. Thus, a trade is not
taken with a trend following tool unless ADX is above 25 and a trend trade is closed if ADX falls
below 20.
It must be stressed that this is a very simplistic use of a sophisticated indicator. Of even more
importance is to use such an idea only as a filter — not as a trading method in its own right. Thus
the signals are taken from other trend-following tools, but only implemented if ADX is above 25 and
the trend following approach closed out if ADX falls below 20.