Explainer · Kresmion Research
What Is MACD? The Moving Average Convergence Divergence Indicator Explained
Published by Kresmion Research. Read our editorial approach and data methodology.
MACD, short for moving average convergence divergence, is the gap between a 12-period and a 26-period exponential moving average of price, tracked over time.
MACD is one of the most popular momentum indicators, as StockCharts puts it, and usually appears as a pane under the price with two lines and a set of bars around a zero line. This page covers where it comes from, what each of the three parts measures, how it is calculated, a worked example done by hand, what the named crossings describe, why one stock's MACD cannot be compared with another's, and how Kresmion's charts compute it. It is descriptive throughout.
Where MACD comes from
Gerald Appel developed the Moving Average Convergence Divergence indicator in the late 1970s, according to StockCharts' ChartSchool reference. Its idea is to turn two trend-following lines, a faster and a slower moving average, into a single oscillator by subtracting one from the other. The histogram that most charts now draw with it was a later addition: StockCharts credits Thomas Aspray with developing the MACD-Histogram.
The name describes what the line tracks. When the two averages move apart, they diverge and the MACD value grows in size; when they move toward each other, they converge and it shrinks toward zero.
The three parts
A standard MACD display has three components, and the usual setting is written (12, 26, 9).
- The MACD line is the 12-period exponential moving average (EMA) of closing prices minus the 26-period EMA. It is above zero when the faster average sits above the slower one, and below zero when it sits below.
- The signal line is a 9-period EMA of the MACD line itself: an average of the gap, not of the price.
- The histogram is the MACD line minus the signal line, drawn as bars above or below zero. A bar's height is the distance between the two lines.
Each part is one subtraction or one average further from the price. The histogram is the furthest removed: it measures how the gap between two averages differs from its own average.
How it is calculated
An EMA weights the newest close most, using a smoothing factor of 2 divided by (N + 1): about 0.1538 for 12 periods, 0.0741 for 26 periods and 0.2 for the 9-period signal line. Each new value is the previous value plus that factor times the difference between the new input and the previous value.
The pieces need history before they exist. A 26-period EMA seeded with a simple average of its first 26 closes has its first value on bar 26, so the MACD line starts there. The signal line then needs 9 MACD values, so its first value lands on bar 34, and the histogram starts with it. A platform that seeds the averages differently, or starts the calculation at a different point in the history, shows slightly different values for the same day, the same effect that makes RSI readings differ between charts.
A worked example
Take a hypothetical stock whose averages, after yesterday's close, stand at:
| Component | Yesterday |
|---|---|
| 12-period EMA | 101.00 |
| 26-period EMA | 100.00 |
| MACD line | 1.00 |
| Signal line | 0.80 |
| Histogram | 0.20 |
Results below use the unrounded factors 2/13, 2/27 and 2/10, and are rounded to four decimals.
Day 1: the stock closes at 104.00.
- 12-period EMA: 101.00 + (2/13) x (104.00 minus 101.00) = 101.4615
- 26-period EMA: 100.00 + (2/27) x (104.00 minus 100.00) = 100.2963
- MACD line: 101.4615 minus 100.2963 = 1.1652
- Signal line: 0.80 + 0.2 x (1.1652 minus 0.80) = 0.8730
- Histogram: 1.1652 minus 0.8730 = 0.2922
The faster average moved about one and a half times as far as the slower one on the same close (0.4615 against 0.2963), so the gap between them widened.
Day 2: the stock closes at 103.00, one dollar lower.
- 12-period EMA: 101.6982; 26-period EMA: 100.4966
- MACD line: 1.2017, higher than the day before
- Signal line: 0.9388
- Histogram: 0.2629, lower than the day before
The price fell, and the MACD line still rose, because 103.00 sits above both averages and pulls the faster one up more than the slower one. The histogram shrank because the signal line caught up with the MACD line. One down close moved the three parts in different directions, which is a reminder that each one answers a different question about the same prices.
What the common readings describe
The readings people name are all events in the arithmetic above, and each describes past closes.
- Zero-line cross. The MACD line crossing above or below zero is the moment the 12-period EMA crosses above or below the 26-period EMA. It is the same geometric event as a moving average crossover, on a pair of 12- and 26-period exponential averages.
- Signal-line cross. The MACD line crossing above or below its signal line, which is the moment the histogram changes sign.
- A shrinking or growing histogram. The distance between the MACD line and its own average is narrowing or widening, as on day 2 of the example.
- Divergence. Price makes a new high or low and the MACD line does not, a different use of the word from the one in the indicator's name. It says the gap between the two averages was smaller in size at the newer extreme than at the previous one.
Because every input is a close that has already printed, each of these events is confirmed only after the moves that produced it. StockCharts also notes that MACD has no upper or lower limit, so it is not built to mark overbought or oversold levels the way a bounded 0 to 100 scale such as RSI is, and in sharp moves it can extend past its own historical extremes.
Why MACD values cannot be compared across assets
The MACD line is a difference between two prices, so it is measured in the same currency units as the price. StockCharts gives the example that a $20 stock's MACD might range from about minus 1.5 to 1.5 while a $100 stock's ranges from about minus 10 to 10. A MACD of 2.0 is a wide gap for the first and a narrow one for the second, and the same stock's MACD is not comparable with itself across years in which its price changed a lot.
The usual fix is the Percentage Price Oscillator, which divides the same gap by the slower average and multiplies by 100, so the value is a percentage of price. Kresmion's charts offer MACD in price units and do not include the percentage version as a built-in indicator.
MACD in Kresmion's charts
Kresmion's charting workspace lists MACD in the momentum group of its Indicators menu, drawn in its own pane below the price, for any stock, index, crypto pair or other market the charts cover. It is computed on closing prices with the standard (12, 26, 9) defaults, and each length can be changed: fast from 1 to 200, slow from 2 to 400 and signal from 1 to 200. The pane draws the MACD line, the signal line and the histogram, with the bars shaded by sign and a reference line at zero. The signal line is computed only from the bars where the MACD line exists, so it starts on bar 34 at the default settings, as in the steps above, rather than being averaged in from empty values. The charts open with a free Kresmion account.
Honest limitations
MACD is built only from past closes. It has no input for volume, news or valuation, and it carries no forward-looking term. Its values depend on the averaging, the seed, the bar interval and whether the closes are adjusted for splits and dividends, so two correct MACDs for the same stock can differ. In a sideways market the lines cross often with no sustained move either way. And because it is in price units, a reading only means something relative to that asset's own price at the time. The worked example uses invented numbers, not data for any real security.
Key takeaways
| Point | Detail |
|---|---|
| Definition | 12-period EMA minus 26-period EMA of closes, in price units |
| Signal line | A 9-period EMA of the MACD line |
| Histogram | MACD line minus signal line; it changes sign at a signal-line cross |
| Worked example | A close of 104 took MACD from 1.00 to 1.1652; a lower close of 103 still raised it to 1.2017 |
| Start-up | At (12, 26, 9) the MACD line starts on bar 26 and the signal line on bar 34 |
| Comparability | Not comparable across assets or price levels; the Percentage Price Oscillator rescales it |
Frequently asked questions
What do the numbers 12, 26 and 9 mean in MACD?
They are the lengths of the three averages: a 12-period EMA and a 26-period EMA, whose difference is the MACD line, and a 9-period EMA of that difference, which is the signal line. On a daily chart they are days, on an hourly chart hours.
What is a MACD crossover?
It usually means the MACD line crossing its signal line, which is when the histogram changes sign. A zero-line crossover is the MACD line crossing zero, the moment the 12-period average crosses the 26-period average. Both describe how averages of past closes relate to each other.
What is the difference between MACD and RSI?
RSI compares the size of recent gains with recent losses on a fixed 0 to 100 scale. MACD measures the distance between two moving averages in price units and has no fixed range. They are built from the same closes and answer different questions about them.
Does a MACD crossover predict a price move?
No. A crossover is an event in averages of closes that have already printed, and it is confirmed only after the moves that caused it. Outcomes after such events vary widely across markets, intervals and periods, and this page makes no claim about what follows one.
Why does my MACD differ from another website's?
Usually because of how the averages were seeded, where in the history the calculation started, adjusted versus unadjusted closes, or a different bar interval. Each EMA carries forward every value before it, so a different starting point leaves a small difference that fades only slowly.
This page is information, not investment advice.
---
Source: StockCharts ChartSchool, MACD (Moving Average Convergence/Divergence Oscillator), https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/macd-moving-average-convergence-divergence-oscillator ; StockCharts ChartSchool, MACD-Histogram, https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/macd-histogram ; StockCharts ChartSchool, Percentage Price Oscillator (PPO), https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/percentage-price-oscillator-ppo ; Kresmion chart engine (MACD indicator, defaults 12, 26, 9). All prices and averages in the worked example are invented.
Kresmion Research.
- · StockCharts ChartSchool, MACD (Moving Average Convergence/Divergence Oscillator): https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/macd-moving-average-convergence-divergence-oscillator
- · StockCharts ChartSchool, MACD-Histogram: https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/macd-histogram
- · StockCharts ChartSchool, Percentage Price Oscillator (PPO): https://chartschool.stockcharts.com/table-of-contents/technical-indicators-and-overlays/technical-indicators/percentage-price-oscillator-ppo
- · Worked example: hypothetical prices and averages computed by Kresmion
- · Kresmion chart engine, MACD indicator (signed-in account)
Put this to work
Real filings, 13F flows, and positioning reads with the source on every number, in your inbox when there is something in the data, or live on Telegram. Free, no account.
No fixed schedule: it goes out when the data has something in it. Unsubscribe anytime.
Kresmion publishes information, not investment advice. See our methodology and the latest research notes.