Learn How to Apply MACD to Your Trading – Part 1
The Moving Average Convergence – Divergence Indicator (MACD) has been a staple of technical analysis since Gerald invented it more than 30 years ago. We speculate that part of the reason why MACD has become so popular is its versatility: you can use it as an indicator with which to recognize and follow strong trends, and also as a tool for recognizing trend reversals.
In this article, we will discuss how to calculate the MACD and some basic ways to interpret it.
How to calculate MACD
The heart of the MACD is the difference between two moving averages: a faster one (reflecting shorter term market trends) minus a slower one (reflecting longer term trends).
We frequently utilize two different sets of moving averages to calculate MACDs: a 12-day exponential moving average as the faster one paired with a 26-day exponential moving average for the slower one, or a 19-day exponential moving average paired with a 39-day average.
For example, the 12-26 day MACD is calculated each day as:
12-day exponential moving average minus 26-day exponential moving average.
This begs the question of how to calculate N-day exponential moving averages (here, N is 12 or 26), which we will now briefly review:
First, find the smoothing constant 2/(N+1). In the case of the 12-day exponential moving average, the smoothing constant would be 2/(12+1) = 2/13 = 0.154. In the case of the 27-day exponential moving average, the smoothing constant would be 2/(26+1) = 2/27 = 0.074.
For brevity, let’s call exponential moving averages by a shorter name, “expo”. Having calculated the smoothing constants we use them to update the exponential moving averages for each new piece of data as follows:
Here is an example of the numerical calculations. Suppose that yesterday, the price was 265, the 12-day expo was 266 and the
26-day expo was 263.
Yesterday’s MACD would therefore have been 12-day expo minus 26 day expo = 266-263 = 3. Now suppose that today’s closing price rose to 270.
One last detail: These formulas are recursive, which means that today’s reading depends on yesterday’s, which does not tell you where to start. A simple approximation is to use the earliest price you have as the earliest exponential moving average reading. Following this procedure introduces a small error, but after a few weeks of data that error becomes negligible.
Basic patterns
Two of the most important features of the MACD are whether it is above or below zero, and whether it is rising or falling.
As a general rule of thumb, the market climate is most unfavorable when MACD is falling and below zero.
This signifies that shorter term market trends are weaker than longer term trends. This is not to imply that every day on which MACD is falling and below zero is necessarily going to be a losing day. However, in our experience, this rule of thumb has correctly identified shorter and longer market corrections.
When you study how MACD works with the vehicles you like to trade, it is vitally important to keep in mind that you cannot act on an MACD reading until the day after the data are in.
You can use this information only for the next day. (Here we assume daily MACDs, but you could apply the same techniques to intra-day data such as 60-minute bars, or to weekly data.)
For example, if we say that periods when the MACD are falling and below zero are unfavorable, we really mean that the days following MACD readings that are falling and below zero have been worse than average.
Let’s see this in action.
Example: Dow-Jones AIG Energy Index
There are two reasons to study this particular index.
1. Given the surge in oil prices to record highs, energy has become a hot topic.
2. There exist exchange-traded notes (similar to ETFs) that track this specific index. Although past results never guarantee what will happen to an investment in the future, we consider it an advantage to trade an investment that has extensive real time history or that tracks an index with an extensive history.
Daily data on the DJ-AIG Energy Index is available back to 1991.
Figure 1 below shows seventeen years of history for the DJ-AIG Energy Index (1991-2008). The gray part of the price chart represents days immediately following MACD readings below zero. The black part of the price chart represents days immediately following MACD readings above zero. Notice that all the major corrections were characterized by MACD less than 0, and the major uptrends by MACD greater than 0.
Figure 1: Dow Jones-AIG Energy Index, 1991-2008 in two colors: Gray when MACD was below zero the day before, and black when MACD was above zero the day before.
Analysis of the daily price and MACD data revealed that on days following when the 19-39 day MACD was greater than zero, the DJ-AIG Energy Index rose at a rate of 14%/year while invested. This favorable condition was in effect 55% of the time. On the other hand, on days following MACD readings below zero, this energy index fell at an annualized rate of 2%/year.
Even worse, days following MACD readings that were falling and below zero saw an annualized loss rate of 11%/year. This bearish condition was in effect 22% of the time. During the entire period, the index gained 6.1%/year. It does appear that the 19-39 day MACD did an excellent job discriminating between bullish and bearish conditions in the energy market.
Conclusion
We have seen how to calculate the MACD, although many of you may be using software packages that do this for you.
The first bits of information to glean are whether the MACD is above or below zero, and whether it is rising or falling. Generally, market conditions are unfavorable when the MACD is falling and below zero.
Next we saw that by converting MACD from units of price (or points) to units of %, it is possible to compare market conditions from periods when prices varied widely. In the case of the Dow Jones Industrial Average, we saw that -3% has historically been a long-term oversold level for the 12-26 week MACD%, and frequently a prelude to excellent market entries.
We cannot emphasize enough that you need to experiment with whatever vehicle you are trading to determine whether the MACD patterns presented here might also be relevant to your own investment, because that will often not be the case.
Also, you should take potential transaction costs into account when deciding how you might want to apply the MACD to your own investing strategies.
The concepts discussed here are covered in more detail in Gerald Appel’s book, “Technical Analysis: Power Tools for Active Investors” (2005).
In the second part of this series Gerald and Marvin Appel will show you how MACD can be used as an indicator of the overall investment climate.
Gerald Appel is the President of Signalert Corporation of Great Neck, New York, an SEC-registered investment advisory firm. He is the inventor of the MACD and the author of a number of groundbreaking investment books, the most recent of which is Beating the Market Three Months at a Time (2008), which he co-authored with Marvin Appel.
Marvin Appel is the CEO of Appel Asset Management Corporation, also an SEC-registered investment advisory firm in Great Neck. He is a renowned expert in exchange-traded funds and the editor of the well-regarded investment newsletter Systems and Forecasts. For more information about the material discussed in this article, please visit www.systemsandforecasts.com.