What is MACD? Definition, Formula, and Example
MACD (Moving Average Convergence Divergence) is a trend-following momentum indicator built from the difference between a 12-period and 26-period exponential moving average, with a 9-period signal line and a histogram showing the gap between the two.
What is MACD (Moving Average Convergence Divergence)?
MACD (Moving Average Convergence Divergence) is a trend-following momentum indicator developed by Gerald Appel in the late 1970s. It tracks the relationship between two exponential moving averages of price to reveal changes in momentum, direction, and duration of a trend. The indicator has three components: the MACD line, the signal line, and the histogram. It is plotted below the price chart and oscillates around a zero line.
MACD Formula
MACD Line = 12-period EMA − 26-period EMA
Signal Line = 9-period EMA of the MACD Line
Histogram = MACD Line − Signal Line
EMAs weight recent prices more heavily than simple moving averages. The 12/26/9 parameters are the standard defaults for daily charts; they can and should be adjusted for intraday use.
A bullish crossover fires when the MACD line crosses above the signal line. A bearish crossover fires when it crosses below. A zero-line crossover occurs when the MACD line itself crosses above or below zero, confirming an EMA crossover in the underlying price.
Worked Example: SPY
On a given session, SPY closes at $525. Suppose:
- 12-period EMA = $523.10
- 26-period EMA = $518.40
- MACD Line = $523.10 − $518.40 = $4.70
- Prior 9-period EMA of MACD values = $4.20 (the Signal Line)
- Histogram = $4.70 − $4.20 = +$0.50
A positive and growing histogram means the MACD line is pulling away from the signal line — momentum is accelerating to the upside. If the histogram bar from the prior session was +$0.30 and it is now +$0.50, momentum is expanding, confirming the trend.
When Traders Use MACD
Swing traders use MACD crossovers to time trend entries and exits with a defined signal rather than a subjective read. The zero-line cross is used as a trend-confirmation filter: only take long MACD crossover signals when the MACD line is above zero (price trend already bullish), only short signals when it's below. Histogram divergence is the highest-conviction MACD setup — price makes a new swing low while histogram bars shrink (loss of downside momentum), signaling likely reversal before price itself confirms it.
Limitations and Misconceptions
MACD is a lagging indicator. By the time a crossover fires on a daily chart, the stock has already moved a significant portion of the anticipated swing. In choppy, sideways markets, MACD generates repeated false crossovers — called whipsaws — that produce a string of small losses. The default 12/26/9 settings were tuned for daily equity charts in the 1970s; intraday traders typically need shorter parameters (e.g., 5/13/4 or 8/17/9). MACD also has no fixed upper or lower bound, making it impossible to define overbought/oversold levels the way RSI can.