MACD
Moving Average Convergence Divergence: the gap between a 12-day and a 26-day exponential average, compared with its own 9-day average.
4 min readLesson 42 of 57
In short
When the gap is above zero, the short-term trend is running ahead of the longer one. Traders watch for the MACD line crossing its signal line as a sign that momentum is turning. Like every trend tool, it lags and gives false signals in choppy markets.
Why it matters
Two moving averages of different lengths tell slightly different stories. A short one follows the last few weeks; a long one follows the last few months. When the short one pulls ahead of the long one, recent prices are running faster than the longer trend, and when it falls back, that push is fading.
MACD turns that gap into a single line you can watch. Gerald Appel created it in the late 1970s, and it's now one of the most common indicators on charting sites, often shown in a panel under the price chart. It's popular because it combines trend and momentum in one picture, but it's built entirely from past prices, so it shares their lag.
How it works
The MACD line is the 12-day exponential average of the close minus the 26-day one. When the price has been rising, the faster 12-day average sits above the slower 26-day one and the line is positive. When the price has been falling, it's negative. The further from zero, the stronger the recent move compared with the longer trend.
The signal line is a 9-day exponential average of the MACD line itself: a smoothed, slower copy. The histogram is the gap between the two, MACD minus signal, usually drawn as bars. When the bars grow, the MACD line is pulling away from its signal; when they shrink toward zero, the two are converging, which is where the name comes from.
The most watched event is a crossover. When the MACD line crosses above its signal line, momentum is turning up, and many traders read it as a buy signal; crossing below is the sell signal. Crossing zero means the 12-day average has crossed the 26-day one, a slower trend signal.
MarketLab starts each exponential average from a simple average of its first closes, as many tools do, so the MACD line needs 26 closes and the signal line 34 before they appear. Tools that start their averages differently show slightly different early values.
MACD = 12-day EMA − 26-day EMA; signal = 9-day EMA of MACD; histogram = MACD − signal
How far the short-term average is ahead of the longer one, compared with its own recent average.
A worked example
Yesterday a stock's MACD line was 1.10 and its signal line 1.20, so the line was below the signal. Today its 12-day EMA is $105.40 and its 26-day EMA is $103.90.
- Today's MACD line: $105.40 − $103.90 = 1.50.
- The signal line is a 9-day EMA, so its smoothing factor is 2 ÷ (9 + 1) = 0.2. New signal: 0.2 × 1.50 + 0.8 × 1.20 = 0.30 + 0.96 = 1.26.
- Histogram: 1.50 − 1.26 = 0.24, a positive bar.
- Yesterday the line (1.10) was below its signal (1.20); today it (1.50) is above it (1.26). The MACD line has crossed above its signal line.
Result: Today is a bullish crossover: the 12-day average is $1.50 ahead of the 26-day one and pulling further ahead of its recent pace. That's a description of the last few weeks, not a promise about the next few; in choppy markets crossovers like this are often reversed within days.
How to read it
- MACD above zero and rising
- The short-term average is above the longer one and the gap is widening: a strengthening uptrend over the last few weeks.
- MACD crosses above its signal line
- The classic buy signal: upward momentum is picking up. MarketLab's stock pages call the state bullish when the histogram is positive.
- MACD crosses below its signal line
- The classic sell signal: momentum is fading or turning down. Shown as bearish.
- Price makes a new high but MACD doesn't
- A divergence: the push behind the rise may be weakening. Often watched, often wrong.
In the real world
- MACD is a default indicator on almost every charting site and trading app, and the 12, 26 and 9 settings are nearly universal. That's partly convention: the lengths were picked decades ago and stuck, not because they're best for every stock.
- Traders often use MACD as a filter rather than a trigger, for example buying an RSI dip only while MACD is above zero. Combining indicators can cut false signals, but each extra rule also adds a chance of Overfitting.
- Like any trend tool, it works best in long, steady moves and worst in sideways markets, where the line keeps crossing its signal. Tests of simple MACD crossover rules on stocks have found mixed results, often no better than buy and hold after costs.
Common mistakes
- Comparing MACD values between stocks. The line is in dollars of price gap, so a $500 stock has a far bigger MACD than a $20 one with the same trend.
- Trading every crossover in a choppy market. Each false signal costs a little in trading costs.
- Forgetting it's built from moving averages. It lags, so crossovers arrive after the turn has started.
- Tuning the 12, 26 and 9 until a backtest looks great. Different settings will win on different stretches of history.
See it in MarketLab
Test yourself
Optional: 4 quick questions on the words, using the idea, and how it plays out in real markets.
Loading your answers…