MACD: How to Read the Moving Average Convergence Divergence
The MACD is a subtraction. Take a fast exponential average of the closing price, take a slower one, and plot the distance between them; every other feature of this indicator is built on top of that single number. Vike computes it as batch_macd, one of the momentum family in our engine.
Below is the arithmetic first, then the crossover rule everybody quotes, then 973 real crossovers scored against real forward bars — including the ones that cost money, and including the popular filter that made the results worse rather than better.
What the MACD actually measures
Two averages of the same price series can only be apart for one reason: recent bars differ from older ones.
A twelve-period average forgets quickly and a twenty-six-period average forgets slowly, so the gap between them widens exactly when new prices stop resembling the ones already in the window. Widening upward means the recent stretch is running hotter than the longer stretch. Narrowing means that difference is being reabsorbed. Zero means the two windows now agree, which is a statement about the past and about nothing else.
So the line is not a measure of trend strength, and it is not bounded. It is a distance — quoted in the asset's own currency, taken between two summaries of the very same closes, and therefore readable only against its own history rather than against another chart.
The exact MACD formula our engine runs
batch_macd runs. The histogram is not an extra input — it is the last subtraction in the chain.Most descriptions stop at "twelve, twenty-six and nine" and leave the interesting parts unsaid.
Here is the whole computation. Run an exponential average over the closes at length 12, run another at length 26, and subtract the second from the first wherever both exist. That difference is the MACD line. Smooth the MACD line with a further nine-period exponential average to get the signal, then subtract signal from line to get the histogram.
How Vike computes it.batch_macdbuildsema(close, 12) − ema(close, 26), finds the first bar where that difference exists, and runs the nine-period signal average over that defined tail only — never over the leading gap. Each average seeds at index n − 1 with the plain mean of its first n values, then follows the recurrence with alpha = 2 ÷ (n + 1). That puts the line on bar 25 and both the signal and histogram on bar 33 — exactly whatlookback_fulladvertises.
I ported that rule out of the crate source, then checked it against the Python implementation the crate was itself ported from. Across fourteen symbols and a thousand daily bars each — 40,726 compared values covering line, signal and histogram — the largest absolute difference was 0.000e+00, and the warm-up masks matched bar for bar. Bitwise identical, in other words, which is the only reason the measurements further down are worth quoting at all.
Reading the MACD histogram
A histogram bar is not a third measurement. Every one of them equals the line minus its signal, so the series hits zero on exactly the candle where the two lines touch, and each bar's height is the distance between them.
That makes it a rate-of-change display for the crossover you are waiting on. Shrinking bars mean the lines are converging; growing bars mean they are separating. Traders who watch the histogram rather than the lines are watching the same event through a magnifying glass.
Scale is where this gets misread, because these values carry price units. On the sample I measured, the widest reading Bitcoin produced was 7,019 while Dogecoin's was 0.0634 — the same indicator, four orders of magnitude apart, and neither number means anything next to the other. Normalize by price and they become comparable: as a percentage of the closing price, the median absolute histogram reading was 0.83%, the ninety-fifth percentile 2.86%, and the largest in 13,538 readings 7.20%. Any "the histogram is high" claim that skips that step is comparing dollars against cents.
How to trade the MACD crossover
Here is the textbook rule, stated tightly enough to be proven wrong: buy when the line crosses above its signal, sell when it crosses beneath.
Across 13,370 bars where both series existed, that fired 973 times — one signal every 13.7 bars, split almost evenly at 487 bullish and 486 bearish. Scoring each one first-touch over the following ten bars, a 6% target against an 8% stop, and awarding the loss whenever a single bar tagged both levels, the long side came back 244 wins to 198 losses and the short side 279 to 151.
Those read as 55.2% and 64.9%. Now price the payoff in: risking eight to make six requires 57.1% just to break even before fees, which puts the long side below water and leaves the short side with genuine room above the bar. A hit rate quoted without its payoff is decoration, and this is what that looks like in practice.
Both figures were produced by the same bracket on the same fourteen symbols as the Stochastic Momentum Index page, so they line up directly against each other. I use that comparison far more than either number alone.
Where the MACD fails
Now the uncomfortable half, and both failures shown here are real signals this detector produced.
Whipsaw is the first and largest problem. Of 959 consecutive crossover pairs, 247 were undone by the opposite cross within five bars — better than one in four reversed almost immediately, each one a round trip through the spread for no reason at all.
Lateness is the second, and it is structural rather than fixable. By the time the lines actually touch, the histogram has typically been shrinking for a while already: median three bars, and seven bars at the ninetieth percentile. I learned to treat a touch as confirmation of something already visible, never as the news itself.
Then there is the filter everyone recommends, which I expected to help. Demanding that bullish crosses happen below zero and bearish ones above it — the classic zero-line condition — cut the sample to 350 and 270 and moved the hit rates to 54.7% and 61.3%. Both got worse. That surprised me enough to rerun the whole scan, and I've stopped describing the zero-line condition as an improvement since.
Is this the textbook 12/26/9?
Yes, with one caveat. That caveat changes real numbers, and it is worth more than everything else on this page.
The crate's structure is Appel's original exactly: fast average minus slow average, then a nine-period average of the result. Where implementations diverge is the seed. Ours begins every exponential average from the arithmetic average of the opening twelve or twenty-six closes and emits nothing at all before that point. The other common convention, the one behind pandas.ewm(adjust=True) and several charting packages, defines a fully weighted value from the very first bar, so it prints a MACD on bar one.
Both converge. Neither agrees early. On Bitcoin daily bars the gap between the two conventions came to 179.7% of the line at bar 40; it had shrunk to 0.23% by bar 100, to 0.001% by bar 200, and to nothing visible by bar 500. More to the point, they named a different line as the higher one on 7 of 966 bars — seven phantom crossovers, produced by a seeding choice and by nothing else. When I compare a signal against somebody else's chart, that is now the first thing I check, because an early divergence is not a bug in either implementation.
Frequently asked questions
What are the best MACD settings? Twelve, twenty-six and nine are the defaults, and every figure here was measured on them. Shorter parameters multiply crossings without improving them, and each extra crossing is one more chance to be wrong.
Is the MACD a leading indicator? No. It reads closed bars and smooths them twice, so it can only describe what already happened — the measurement above puts the histogram's turn a median of three bars ahead of the cross it eventually produces. Slower average pairs lag further still, which is the whole story of the golden cross.
Why do the first bars show nothing? Two stacked exponential averages need 25 bars before any line exists and 33 before the signal does. Emitting a partial average dressed up as a real value would be worse than emitting nothing.
Can I compare MACD readings across coins? Not raw. The values are in each asset's price units, so divide by the close before comparing anything; the 7,019-versus-0.0634 gap above is what happens otherwise.
Which indicator pairs well with the MACD? Something that reads a different input. A hammer is one bar with no smoothing at all, and RSI normalizes gains against losses rather than measuring a distance, so both disagree with this line in useful ways.
This is educational material, not financial advice. Every number here was measured on past bars, past behavior generalizes poorly, and trading carries real risk of loss — size any position so that being wrong stays affordable.