What is moving average convergence or divergence (MACD)?

Here's one way investors can use technical analysis to decide when to buy or sell a stock.

Shocked office worker staring at computer screen with colleagues working in the background.

Image source: Getty Images

Like other technical investing techniques, the moving average convergence or divergence (MACD) helps traders decide when to buy or sell stock based on its recent price action.

This kind of investing differs from fundamental investing, which is focused on the business's performance. In technical investing, traders buy and sell based on the stock's movements and mostly ignore information on the business, such as earnings reports.

Image source: The Motley Fool

The MACD compares two exponential moving averages (EMAs): the 26-session and 12-session EMAs. Unlike a simple moving average, an exponential moving average gives more weight to more recent data points. A session, in this case, refers to a trading day.

The MACD line is made by subtracting the 26-period EMA from the 12-period EMA, or the long-term line from the short-term one. Because the line is made by subtracting one moving average from another, it shows whether they are converging or diverging and adds weight to short-term movements.

How do you use the MACD?

Once you've determined the MACD, you can then take the nine-day EMA of the MACD line — called the signal line — and plot that on top of the MACD line as a guide to buy or sell a stock.

When the MACD line crosses above the signal line, that's a buy signal, showing the stock is rallying. When the MACD falls below the signal line, that should trigger a sell. Traders should also take into account how fast the charts are rising or falling, as well as divergences between the two lines since a large divergence could signal that a stock is overbought or oversold.

Investors can use any increment of time for the MACD, although the most common is 26/12/9 days. By tracking short-term movements this way, traders believe they can get a sense of whether a stock is oversold or overbought.

Does the MACD work?

The MACD is something of a one-size-fits-all indicator. Because it offers both leading and lagging indicators and a moving average trigger line, it's responsive to short-term signals and makes it relatively easy to know when to buy or sell a stock, according to the indicator.

The strategy's simplicity makes it easy for traders of all levels to use, as it's less complex than other technical indicators, and the chart is easy to read.

No technical tool is right all the time, and the MACD is best used in conjunction with other technical indicators and market trackers. The MACD is best known for tracking trend reversals and can work well in directional markets. However, it tends to be unreliable when stocks are trading sideways or not trending in any particular direction.

An example of the MACD

Let's say you're tracking the S&P 500 Index (SP: .INX) and want to trade with a popular index fund like the SPDR S&P 500 ETF Trust (NYSEARCA: SPY). Say its 26-day exponential moving average is 400, and the 12-day exponential moving average is 395; you would have a MACD of -5.

A few days later, the 12-day EMA is higher than the 26-day one, giving you a MACD of 3. You would want to buy the stock when the MACD turned positive, which signals an entry point as the stock (or index fund, in this case) is moving higher. If the MACD stretched to 10, however, some traders might interpret that as a sign that the stock was oversold.

Technical indicators like the MACD can give traders further insight into the short-term direction of the market. Long-term investors trying to ride the next bull market are better off investing in fundamentally strong businesses. But understanding technical indicators like the MACD can help guide your decision-making and understand why the market moves the way it does.

You don't have to trade with the MACD to use it. Following it for a few weeks might help you gain some other short-term trading insights.

This article contains general educational content only and does not take into account your personal financial situation. Before investing, your individual circumstances should be considered, and you may need to seek independent financial advice.

To the best of our knowledge, all information in this article is accurate as of time of posting. In our educational articles, a 'top share' is always defined by the largest market cap at the time of last update. On this page, neither the author nor The Motley Fool have chosen a 'top share' by personal opinion.

As always, remember that when investing, the value of your investment may rise or fall, and your capital is at risk.

The Motley Fool has a disclosure policy. This article contains general investment advice only (under AFSL 400691). Authorised by Scott Phillips.