MACD, short for moving average convergence divergence, is a momentum indicator built from two exponential moving averages of the same price. It shows how far a shorter average has moved away from a longer one, and how that gap is changing. Traders watch three parts: the MACD line, the signal line and the histogram. The indicator is one of the most common tools on trading platforms, and it is often used to judge whether a trend is gaining or losing strength.
This guide shows how each part is calculated, works through an example with invented prices, and explains how traders read crossovers and divergences. It also covers the main weakness of MACD. Because it is built from averages of past prices, it confirms moves that have already started rather than predicting them.
How is MACD calculated?
The MACD line is the 12-period exponential moving average minus the 26-period exponential moving average. The signal line is a 9-period exponential moving average of the MACD line, and the histogram is the MACD line minus the signal line. Those three parts are all the indicator contains.
The 12, 26 and 9 settings are the traditional values, and most platforms use them by default.
When the MACD line is above zero, the shorter average is above the longer one, which indicates that recent prices have been higher than the older ones. When it is below zero, the reverse holds. The histogram shows the distance between the MACD line and its signal, so it grows when the gap is widening and shrinks when the gap is narrowing. Because the settings are conventions rather than measured optima, any change to them should be tested on past data before it is used.
The table below uses invented figures to show the arithmetic for two consecutive periods. The values are illustrative and rounded.
| Step | Period 1 | Period 2 | What it means |
|---|---|---|---|
| 12-period average | 105.0 | 106.0 | Shorter average, follows price closely |
| 26-period average | 100.0 | 101.0 | Longer average, moves more slowly |
| MACD line (12 minus 26) | 5.0 | 5.0 | The gap between the averages |
| Signal line (9-period average of MACD) | 3.2 | 3.6 | Smoothed version of the MACD line |
| Histogram (MACD minus signal) | 1.8 | 1.4 | Whether the gap is widening or narrowing |
In this example the MACD line stays at 5.0, but the signal line rises toward it, so the histogram shrinks from 1.8 to 1.4. The price is still rising, yet the momentum behind the move is easing. That is the kind of change traders look for in the histogram. A shrinking histogram does not mean the trend will end, and a growing one does not guarantee that it will continue.
How do traders read crossovers?
A crossover occurs when the MACD line crosses its signal line. A move of the MACD line above the signal line is commonly read as bullish, and a move below as bearish. Crossings of the zero line are read as a change in the broader direction of the average gap.
Many traders wait for a crossover to happen away from the zero line, because crossings near zero tend to occur in flat markets and produce more false signals.
The main weakness is lag. Each part of MACD is built from averages of past prices, so a crossover usually appears after the move has already started. A trader who waits for a crossover may enter well after the best part of a move has passed. That does not make the signal useless, but the reward for each signal may be smaller than the chart suggests, and the stop must be placed with the lag in mind.
Crossovers also differ by context. A bullish crossover that happens while the MACD line is still below zero is usually a recovery inside a weaker trend, while one that happens above zero is a continuation of an existing strength. Traders who use the signal should decide in advance which of these they will act on, and test each separately. Mixing them together can make a rule look better or worse than it is.
How are divergences used?
MACD divergence compares the price with the indicator. Bearish divergence appears when the price makes a higher high while the MACD makes a lower high, which suggests that momentum behind the new high is weaker. Bullish divergence appears at a low when the price makes a lower low and the MACD makes a higher low.
Divergence is a warning rather than a trigger. The price can keep making new highs or lows for a long time while the indicator stays weak.
Because the points used to judge a divergence are chosen by eye, two traders can see different divergences on the same chart. Mark the price highs or lows first, then compare the indicator at those exact points. Set the rule in advance, and check it across many charts, including the ones where the price kept going.
What does the histogram add to the picture?
The histogram is the gap between the MACD line and its signal line, drawn as bars. Its height shows how far apart the two lines are, and its direction shows whether that gap is growing or shrinking. Many traders watch the histogram because it can turn before a crossover appears, which gives an earlier and noisier clue.
Consider the example above. A histogram that falls from 1.8 to 1.4 tells you momentum is slowing even though both lines are still above zero. If the next bar fell below zero, the MACD line would have crossed its signal line, and that crossover would be visible on the chart. The histogram therefore gives the warning first, at the cost of more false alarms.
Read the histogram against its own recent range. A bar of 1.4 means little if the histogram has swung between 3 and minus 3 for months, and it means a great deal if the recent bars have been close to zero. Some traders compare successive peaks in the histogram, which is a way of spotting momentum that is fading from one swing to the next.
Common mistakes
Entering on the first crossover. In a range, crossovers come and go. Wait for a clear move away from the zero line and confirming price action.
Ignoring the zero line. A bullish crossover below zero is a different situation from one above it. Read the position of the MACD line as well as the crossing.
Expecting MACD to flag turns in time. Lag is built into the method. Plan the stop and the position size with that in mind.
Checklist
- Confirm the settings are 12, 26 and 9, or record any changes you make.
- Check the trend on a higher timeframe before you act on a crossover.
- Note whether the crossover happens above or below the zero line.
- Watch the histogram for a change in its growth, not only its colour.
- Mark price highs or lows first when you look for divergence.
- Wait for a confirming move in the price before acting on a signal.
- Test the rule on past data, including all failed crossovers, and keep a written record.
Key takeaways
MACD is the gap between a 12-period and a 26-period exponential average, a 9-period signal line and the histogram between them. Crossovers and divergences are read as signs of changing momentum, but both appear late and both can be false in ranges. The histogram is often the most useful part, because it shows whether the gap between the averages is growing or shrinking.
This guide is for general information, not financial advice. See the disclaimer.