The Moving Average Convergence Divergence — Gerald Appel's trend-momentum hybrid (1979).
Signal Line = EMA(9) of MACD
Histogram = MACD − Signal
1. Signal crossover: MACD crosses above Signal → buy; below → sell
2. Zero-line crossover: MACD crosses above zero → bullish trend
3. Divergence: Price makes new high but MACD doesn't → weakening momentum
The histogram shows the rate of change of the MACD/Signal relationship — when bars shrink, a crossover is coming.
With fast 3, slow 6 and signal 3 (the standard 12/26/9 needs more than 15 days). MACD peaked at 1.77 on day 7 with the rally. The histogram turned negative on day 8 (−0.03), the first down day after the peak, and back to positive on day 15 (+0.44), one day into the rebound.
The example data: 15 days, used in every indicator here
| Day | High | Low | Close | Volume |
|---|---|---|---|---|
| 1 | 101 | 99 | 100 | 50,000 |
| 2 | 103 | 100 | 102 | 62,000 |
| 3 | 103 | 100 | 101 | 48,000 |
| 4 | 105 | 101 | 104 | 70,000 |
| 5 | 108 | 104 | 107 | 85,000 |
| 6 | 108 | 105 | 106 | 60,000 |
| 7 | 110 | 106 | 109 | 90,000 |
| 8 | 110 | 107 | 108 | 72,000 |
| 9 | 108 | 104 | 105 | 80,000 |
| 10 | 105 | 102 | 103 | 66,000 |
| 11 | 105 | 102 | 104 | 55,000 |
| 12 | 104 | 101 | 102 | 75,000 |
| 13 | 102 | 98 | 99 | 95,000 |
| 14 | 102 | 99 | 101 | 64,000 |
| 15 | 105 | 101 | 104 | 71,000 |
- Both lines come from lagging averages, so crossovers confirm turns rather than anticipate them.
- In a sideways market MACD hovers around zero and produces a crossover every few bars.
- Values are in price units, so readings cannot be compared across assets, or across very different price levels, without scaling.
fast = df['close'].ewm(span=3, adjust=False).mean() slow = df['close'].ewm(span=6, adjust=False).mean() df['macd'] = fast - slow df['signal'] = df['macd'].ewm(span=3, adjust=False).mean() df['hist'] = df['macd'] - df['signal']
Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.
- G. Appel, Technical Analysis: Power Tools for Active Investors, FT Prentice Hall, 2005
- C.-H. Park & S. H. Irwin, “What Do We Know About the Profitability of Technical Analysis?”, Journal of Economic Surveys 21(4), 2007 — a review of the evidence across studies
Last reviewed October 2026 · How this site checks its content · Report a mistake
1. What is the MACD line?
Show answer
B. The signal line is a 9-period EMA of the MACD line.
2. What does the MACD histogram show?
Show answer
A. The histogram shrinks before a crossover, which is why some traders watch it for early warning.
3. Why do MACD crossovers often come late?
Show answer
B. Every smoothing step trades noise for lag. Signals confirm moves that have already started.
- Crossovers work better in trends than in ranges; an ADX filter (e.g. trade only when ADX > 25) is a common way to skip choppy periods — test it rather than assume it
- Histogram divergences are a popular early warning, but they also persist through many trends that never reverse
- Gerald Appel introduced MACD in the late 1970s; the 12/26/9 defaults are convention, not optimised values — re-tuning them on your own data is a search with all the risks of one
- LLM EngineeringMulti-Head AttentionRunning multiple attention computations in parallel
- Technical IndicatorsChaikin OscillatorThe momentum of accumulation and distribution, the MACD idea applied to volume flow
- ML MathEval MetricsHow to actually measure if your model is good
- The Toolkitpandas-ta & yfinanceTechnical indicators + market data in one-liners