ESG Investing For Dummies
Book image
Explore Book Buy On Amazon
The moving average convergence divergence (MACD) indicator is a trend-following momentum indicator. MACD is designed to generate trend-following trading signals based on moving-average crossovers while overcoming problems associated with many other trend-following indicators. MACD also acts as a momentum oscillator, showing when a trend is gaining strength or losing momentum as it cycles above and below a center zero line. MACD is an excellent indicator.

How to calculate MACD

Charting packages routinely calculate MACD for you, but knowing how this indicator is created is important for gaining a better understanding of how it works. The MACD calculation isn’t complex; it’s just three exponential moving averages. Here are the steps:
  1. Calculate a 12-period EMA.

  2. Calculate a 26-period EMA.

  3. Subtract the 26-period EMA from the 12-period EMA to create the MACD line.

  4. Use the resulting MACD line to calculate a 9-period EMA to create the signal line.

  5. Plot the MACD as a solid line; plot the signal line as either a dashed or lighter-colored line.

An additional indicator, the MACD histogram, is usually shown as part of the MACD. It uses a histogram to show the difference between the MACD line and the signal line. The histogram is plotted above the zero line when the MACD line is above the signal line, below the zero line when the signal line is above MACD, and at zero when they cross.

Consider this weekly chart of AGCO Corp. (AG) along with an MACD indicator and an MACD histogram. The indicator was originally designed to be used as a weekly chart, and a weekly MACD indicator provides more useful information about the strength and direction of a trend and potential trend reversals. You will find that other traders use this indicator for both longer and shorter periods as well.

A trading chart showcasing a stock's Moving Average Convergence Divergence (MACD) indicator for 2006 and 2007.
Credit: Chart courtesy of StockCharts.com
AG experienced a long period of consolidation before starting to rally in early 2006. The stock continued its ascent through 2006 and 2007. Notice the corresponding periods on the MACD. The MACD line (the solid line) crosses over the zero center line during the third week in February. This was a buy signal for this stock.

You may also notice that the MACD line crossed the signal line in early January 2006. This MACD crossover signal is another early indication suggesting a possible new uptrend.

You can automatically generate an MACD indicator at StockCharts.com as well. Use the dropdown menu in the Indicators section of Chart Attributes to find MACD. Then set the parameters and position it above or below the chart. The parameters for the MACD line suggested above would be 12, 26, 9. You should also select the MACD Histogram with the same parameters.

How to use MACD

MACD provides a remarkable amount of information in a concise format. MACD oscillates above and below a center zero line and is a good indicator for showing the direction of the dominant trend, signaling
  • An uptrend when the MACD line crosses above the center line

  • A downtrend when the MACD line crosses below the center line

Some short-term traders use the signal line to trigger
  • Buy signals when the MACD line crosses above the signal line

  • Sell signals when the MACD line crosses below the signal line

That short-term technique can be unreliable because it generates too many false signals. Instead, consider using the position of the MACD line relative to the zero line as an indication that the stock has begun trending.

The weekly prices for the S&P 500 Depository Receipts is sometimes called SPDRs or Spyders. (The stock symbol is SPY.) SPY is an exchange-traded fund that tracks the S&P 500 index.

A Moving Average Convergence Divergence (MACD) chart showcasing a divergence in the S&P 500 Depository Receipts in the years 2006 and 2007.
Credit: Chart courtesy of StockCharts.com
Notice how the SPY establishes a series of higher highs and higher lows during the period from June through October 2007, but the MACD line establishes a series of lower highs during this period. This creates what’s known as a divergent pattern. This particular example of a divergent pattern is a bearish divergence.

In a bearish divergence, the stock establishes a series of higher lows and higher highs, while the MACD establishes a series of lower highs. A bullish divergence is the reverse: The stock establishes a series of lower lows and lower highs, while the MACD establishes a series of higher highs.

Divergences that occur in the same direction as the dominant trend are often useful for entering positions. However, a divergence that is counter to the dominant trend is less likely to be a reliable trading signal.

This bearish divergence on SPY is best interpreted as a signal showing that the momentum of the multiyear S&P 500 bull market was slowing. In fact, the market peaked in October 2007 and remained in a downtrend for many months.

Each time the MACD line crosses above or below the signal line suggests a potential change in the direction of the dominant trend. Although it’s not an outright buy signal or sell signal, it does suggest that a change may be in the wind.

In the case of a bearish divergence, the best way to exploit that information is to monitor individual stocks and ETFs for weakness and either close long positions when they deteriorate or initiate new short positions as they present themselves.

Most charting packages enable you to fine-tune the MACD calculation. Many traders vary the 12-, 26-, and 9-week values. Although nothing is inherently wrong with this approach, you nevertheless risk the curve-fitting problem whenever you try to find parameters that give you better results for a specific stock.

That said, Gerald Appel, the man who developed MACD, uses values different from the original 12, 26, and 9. He also uses different values to generate buy signals than he does to generate sell signals. So feel free to experiment and have fun after you gain some experience with the default parameters.

About This Article

This article can be found in the category: