Technical analysisModule 3, lesson 15 of 32
MACD
How the MACD line, signal line and histogram are built from exponential moving averages, what each measures, and why all three lag rather than give early signals.
In this lesson
- Calculate the MACD line from two exponential moving averages.
- Explain the signal line and the histogram.
- Explain why MACD crossovers lag price turning points.
- Interpret MACD in trending and sideways markets.
Builds on
- Moving averagesMACD is built entirely from exponential moving averages.
On this page
In simple terms
MACD, short for moving average convergence divergence, compares a faster moving average of price with a slower one. When the faster average is above the slower one, recent prices are rising faster than older ones; when it is below, recent prices are weaker.
MACD has three parts:
MACD line = 12-period EMA of price − 26-period EMA of price signal line = 9-period EMA of the MACD line histogram = MACD line − signal line
The moving averages lesson explains how exponential moving averages (EMAs) are calculated. The 12, 26 and 9 settings are the conventional ones; charting tools let you change them.
Reading each part
The MACD line is positive when the 12-period EMA is above the 26-period EMA, which happens after prices have been rising, and negative after prices have been falling. Its distance from zero shows how far apart the two averages are.
The signal line is a smoothed version of the MACD line. Crossings between the two are the most commonly quoted MACD signals.
The histogram shows the gap between the MACD line and its signal line. When the histogram shrinks, the MACD line is moving towards the signal line: momentum is slowing.
Worked example: A made-up share's MACD
| Day | 12-day EMA | 26-day EMA | MACD line | Signal line | Histogram |
|---|---|---|---|---|---|
| 1 | 496 | 500 | −4.0 | −2.5 | −1.5 |
| 2 | 499 | 500 | −1.0 | −2.2 | +1.2 |
| 3 | 503 | 501 | +2.0 | −1.4 | +3.4 |
| 4 | 507 | 502 | +5.0 | −0.1 | +5.1 |
On day 2, the MACD line crossed above the signal line (a "bullish crossover"); on day 3, it crossed above zero. Both happened after prices had already turned up, since the 12-day EMA had to rise above the 26-day EMA first.
Why MACD lags
MACD is built from moving averages, which lag price. The signal line is a moving average of that, which lags further. So:
- a MACD crossover above zero happens only after the shorter average has overtaken the longer one, which takes time after a price turn;
- a signal-line crossover is a bit earlier, but still follows the price.
MACD crossovers are therefore confirmations, not early warnings. They tell you a change in momentum has already happened, which is sometimes useful, but they cannot catch a turn before it occurs.
Trends and ranges
In a strong trend, MACD stays on one side of zero for long periods, and signal-line crossovers against the trend are often brief pauses.
In a sideways market, the two EMAs stay close, the MACD line hovers near zero, and crossovers flip back and forth, giving repeated false signals, the same whipsaw problem moving-average crossovers have.
Divergences
As with RSI, traders watch for divergences: the price makes a new high while MACD makes a lower high. This shows slowing momentum. It may precede a turn, or the trend may continue with further divergences. Test it rather than trust it.
Why it matters
MACD is one of the most commonly displayed indicators, often presented as giving "buy" and "sell" signals. Understanding that it is a difference between two moving averages, smoothed again, makes clear why its signals lag and why they fail in sideways markets. That understanding stops you treating crossovers as predictions.
Limitations
MACD lags and whipsaws. Its values are in rupees (the difference between two prices), so MACD levels cannot be compared between shares with very different prices. The standard settings are conventions, and tuning them to past data invites overfitting.
Common mistakes
- Calling MACD crossovers early signals.
- Using MACD in sideways markets without expecting false crossovers.
- Comparing MACD values across shares with different price levels.
- Optimising the settings to fit past charts.
Try it yourself
- On a charting tool, add MACD with standard settings to a daily chart of any share.
- Find the last three signal-line crossovers and note how far the price had already moved before each one.
- Find a sideways period and count the crossovers within it.
- Write down whether MACD's signals came before or after the main price turns.
Key takeaways
- The MACD line is the difference between a 12-period and a 26-period exponential moving average of price. It shows whether shorter-term momentum is above or below longer-term momentum.
- The signal line is a 9-period EMA of the MACD line. The histogram is the MACD line minus the signal line.
- Because it is built from moving averages, and then a moving average of those, MACD lags price. Its crossovers confirm moves that have already happened.
- MACD works best as a description of trend momentum and gives many false crossovers in sideways markets.
- The standard 12, 26 and 9 settings are conventions; changing them changes every signal.
Check your understanding
Finished reading?
Your progress is saved only in this browser.
Terms used in this lesson
- MACD
- An indicator built from the difference between a 12-period and a 26-period exponential moving average, with a 9-period signal line and a histogram.
- Moving average
- The average closing price over the last N periods, recalculated each period, used to smooth price movements and describe trends.
- Momentum oscillator
- An indicator that describes the speed or strength of recent price changes, usually swinging between fixed limits.
Spotted a mistake or something unclear? Report it by email. Here is how corrections work.
This lesson is general education, not investment advice. Examples use made-up or clearly dated figures to explain ideas; they are not recommendations. Read the disclaimer.