What Is MACD? Formula, How to Read It, and a Worked SPY Example
Moving average convergence divergence (MACD) is the distance between a twelve-period and a twenty-six-period exponential moving average, drawn as a line. A nine-period average of that line is the signal line, and the histogram is the gap between the two. It is a trend-following tool built entirely from moving averages.
Covered on this page: TradingView.
MACD (moving average convergence divergence) is the 12-period exponential moving average minus the 26-period one, plotted as a line under the price chart. A 9-period average of that line is the signal line, and the bars, called the histogram, show the gap between them.
Gerald Appel built it in the late 1970s, and the panel looks busier than the idea behind it. This page does the arithmetic by hand on a real SPY close, shows what the readings looked like through 2026, and measures 33 years of daily data to see what the zero line does and does not tell you.
How it works
Everything starts with two exponential moving averages of the closing price. An exponential moving average (EMA) gives the newest close a fixed share of the weight and passes the rest on to the old average. For a 12-day EMA the newest close gets 2/13 and yesterday’s EMA keeps 11/13. For a 26-day EMA the split is 2/27 and 25/27.
The MACD line is the 12-day EMA minus the 26-day EMA. When the quicker average is above the slower one, the number is positive. When it is below, the number is negative. When they are equal, MACD is zero.
The signal line is a 9-day EMA of the MACD line, using 2/10 for today’s MACD value and 8/10 for yesterday’s signal. It is an average of a difference of averages, which is why it always trails.
The histogram is MACD minus signal. It is not volume and it is not a separate input. It is the distance between the two lines, drawn as bars so the gap is easier to see.
Nothing on the panel knows anything the two moving averages did not. Every reading is a restatement of where a quick average of the closes sits against a slow one.
How to read the three parts
The zero line answers one question: which average is on top? Above zero, the 12-day EMA is higher than the 26-day EMA, so recent closes have been running above the longer average. Below zero, the reverse. Crossing zero is the moment the two EMAs cross each other.
The signal line answers a smaller question: is MACD rising or falling against its own recent past? When MACD crosses above its signal, the line has climbed above a 9-day average of itself. The MACD crossover page covers both kinds of cross and why they are easy to mix up.
The histogram shows how far apart the line and signal are. Tall bars mean the averages are pulling apart quickly. Shrinking bars mean that pull is fading, and a cross happens when the bars reach zero. The MACD histogram page goes deeper on reading the bars.
When price and MACD disagree, for example price makes a higher high while MACD makes a lower one, that is called a divergence. It has its own page, MACD divergence, because choosing which two peaks to compare is where most of the judgment sits.
A worked example
SPY, Friday 30 Oct 2026. SPY closed at $755.72, down from $769.36 the day before. At the close on 29 Oct its 12-day EMA was $768.85, its 26-day EMA was $768.81, MACD was $0.04 and the signal line was $0.38. Those are the only inputs needed.
Step 1, the 12-day EMA. $755.72 × 2/13 = $116.26. $768.85 × 11/13 = $650.57. Add them: $766.83.
Step 2, the 26-day EMA. $755.72 × 2/27 = $55.98. $768.81 × 25/27 = $711.86. Add them: $767.84.
Step 3, the MACD line. $766.83 − $767.84 = −$1.01. The 12-day average has dropped below the 26-day one, so MACD is below zero.
Step 4, the signal line. −$1.01 × 2/10 = −$0.20. $0.38 × 8/10 = $0.30. Add them: $0.10.
Step 5, the histogram. −$1.01 − $0.10 = −$1.11.
The script behind this page, running the same 12, 26 and 9 settings over SPY’s whole history from 1993 without rounding, gets −$1.01, $0.10 and −$1.11 to the cent. A $13.64 drop in one day pulled the quick average down $2.02 and the slow one $0.97, about twice as far, which is the whole mechanism in one step.
Here is the week around it, from the same file:
| Session | Close | 12-day EMA | 26-day EMA | MACD | Signal | Histogram |
|---|---|---|---|---|---|---|
| 22 Oct | $763.96 | $769.79 | $769.32 | $0.47 | $1.54 | −$1.07 |
| 23 Oct | $759.97 | $768.28 | $768.63 | −$0.35 | $1.16 | −$1.51 |
| 26 Oct | $765.37 | $767.83 | $768.39 | −$0.56 | $0.82 | −$1.37 |
| 27 Oct | $769.66 | $768.11 | $768.48 | −$0.37 | $0.58 | −$0.95 |
| 28 Oct | $772.31 | $768.76 | $768.77 | −$0.01 | $0.46 | −$0.47 |
| 29 Oct | $769.36 | $768.85 | $768.81 | $0.04 | $0.38 | −$0.34 |
| 30 Oct | $755.72 | $766.83 | $767.84 | −$1.01 | $0.10 | −$1.11 |
Look at the MACD column. It crossed zero on 23 Oct, crossed back above on 29 Oct by four cents, and crossed below again the next day. Three zero crosses in six sessions, while the two averages sat within about a dollar of each other on a $760 fund. That is what a MACD line hugging zero means in real numbers.
Reading a real chart: SPY in 2026
The same calculation, run over eight months, shows the two moods MACD has. The chart starts in early March, when SPY was sliding toward its 30 Mar closing low of $631.97.
The trend: March to May. MACD fell to −$11.49 at the 30 Mar low, then rose with the rally. It crossed zero on 13 Apr with SPY at $686.10, nine sessions and 8.57% above that low, and kept climbing to +$15.42 on 14 May. Both averages pointed the same way for weeks, and MACD stayed well clear of zero.
The range: July to October. Across those 86 sessions SPY closed between $729.46 and $779.09. MACD never went below −$1.51 or above +$8.51, and it crossed zero 7 times and its signal line 8 times. None of those crosses started a move like April’s. The chart marks ten zero crosses in all: 13 Apr, then nine from 26 Jun onward.
One more thing the chart shows. SPY’s highest close of the period came on 6 Oct at $779.09, well above the 14 May close of $748.17, yet MACD read +$2.30 on 6 Oct against +$15.42 on 14 May. A higher price high with a lower MACD high is a divergence.
On this chart it was followed by a drift, not a collapse: SPY was at $755.72 on 30 Oct, still above the May level.
What 12, 26 and 9 change
The 12 sets how quickly the line reacts. Shorten it and the line jumps more and crosses zero more often.
The 26 is the slow baseline. Lengthen it and zero crosses become rarer and later.
The 9 only smooths the line you already have. It changes when a signal cross happens, not what is being measured. TradingView’s built-in MACD lets you switch the line or the signal to a simple average; the defaults are EMA for both.
The defaults are simply the most common values in use, and nothing about them is tuned to any market. Any three numbers can be fitted to catch the turns on a chart you have already seen, which is why changing them after the fact proves nothing.
The original data
Sample: SPY daily closes from Yahoo Finance, 29 Jan 1993 to 30 Oct 2026, 8,497 sessions, split-adjusted and not dividend-adjusted (the price a chart shows). EMAs start from the simple average of their first 12 or 26 closes, then follow the formula above. Readings below count from 18 Mar 1993, the first session with a signal value: 8,464 sessions, 33.62 years. Every row is in the SPY MACD file.
How often each state happened. MACD was above zero on 5,719 sessions (67.57%) and below it on 2,745. It crossed zero 271 times, 8.06 times a year, and crossed its signal line 738 times, 21.95 times a year. 2026 has been busier than usual: 11 zero crosses by 30 Oct.
Did the zero line sort what came next? For every session with 20 sessions after it, SPY’s close 20 sessions later was higher than that day’s close:
| MACD that day | Sessions | Closed higher 20 sessions later | Median change |
|---|---|---|---|
| Above zero | 5,704 | 3,627 (63.59%) | 1.10% |
| Below zero | 2,740 | 1,767 (64.49%) | 1.81% |
| Every session | 8,444 | 5,394 (63.88%) | 1.28% |
The finding: on SPY, knowing which side of zero MACD sat on told you nothing about the next 20 sessions. Both groups landed within a point of the base rate, and below zero was slightly higher, not lower.
Splitting the period gives the same answer: before 2010 the shares were 60.77% above and 60.43% below (base 60.65%); from 2010 they were 66.12% and 69.61% (base 67.13%), so above-zero days came out ahead by 0.34 points at most and fell 3.49 points behind after 2010. Gaps this size are within what chance alone produces here. These are overlapping 20-session windows, so the sessions are not independent, and SPY mostly rose, so any “higher” figure starts near two in three. MACD describes the trend that has already happened, and that is the job it was built for.
The second finding: MACD’s size is a price effect. Ignoring sign, SPY’s median daily MACD reading was $0.08 in 1993 and $5.40 in 2025, because SPY’s median close went from about $45 to about $621. Divided by the 26-day EMA, the yearly median stayed between 0.17% and 1.37% in every year, and was 0.85% in 2025.
The largest dollar reading in the whole sample, +$15.42 on 14 May 2026, was 2.15% of price; the largest in percent was +3.05% on 9 Jun 2020, when the dollar figure was only $9.18. The deepest reading was −$23.79 on 23 Mar 2020, −8.56% of price. So “MACD at 15” means nothing until you know the price. That conversion is exactly what the percentage price oscillator does.
The check. Nasdaq’s own SPY closes, 31 Oct 2016 to 30 Oct 2026, match Yahoo’s within one cent on 2,512 of 2,513 sessions (the other is seven cents apart; one empty Nasdaq row with no volume was dropped). MACD recomputed from scratch on Nasdaq’s closes gives −$1.01, $0.10 and −$1.11 on 30 Oct 2026, and the same side of zero as the Yahoo series on all 2,470 sessions from 2017.
When it fails
The market is going sideways
This is the main one. Two averages of a flat market sit on top of each other, so MACD hovers at zero and crosses on small moves. July to October 2026 is the example above: 7 zero crosses in 86 sessions inside a range of about 6.8%. Each cross reads as a signal, and none marked the start of a trend.
It confirms late, by design
On 13 Apr 2026 MACD crossed zero with SPY already 8.57% off its low. That lag is the price of using averages, and no setting removes it without adding more false crosses.
A divergence that just fades
October’s higher price high with a lower MACD high was real, and SPY drifted rather than fell. Weaker momentum is not the same as a finished trend.
Comparing readings across markets or years
A MACD of $5 is large on a $50 stock and tiny on a $750 fund. Compare in percent, or not at all.
Treating it as separate evidence
MACD, RSI and most oscillators read the same closes, so two of them agreeing is closer to arithmetic than to confirmation.
Questions people ask
What does MACD tell you?
Whether the 12-day average of closes is above or below the 26-day average, and by how many dollars. It describes the trend already in the prices; on SPY its zero-line state did not sort the next 20 sessions.
Is MACD a leading or lagging indicator?
Lagging. Every part is built from averages of past closes. In April 2026 its zero cross came nine sessions after SPY’s low.
What do 12, 26 and 9 mean?
The 12-day EMA, the 26-day EMA, and the 9-day EMA of their difference that forms the signal line. They are the standard defaults on most charting platforms, not settings tuned to any market.
What is a good MACD value?
There is no fixed good value, because MACD is in the instrument’s own price units. Divide by the 26-day EMA to compare: SPY’s yearly median ranged from 0.17% to 1.37% of price.
How do I use MACD in a trade?
The how to use the MACD guide covers that step by step. This page is the definition and the data.
Related
Moving averages are what MACD is made of, and that page explains the lag it inherits.
RSI is the other oscillator most charts carry, and it fails in a different way worth seeing.
Market structure answers the question MACD is usually asked, whether a trend exists, by reading highs and lows instead of a smoothed summary of them.
For the variants and parts, see the impulse MACD, which stays flat inside a range, and the crossover, histogram and divergence pages linked above.
This sits in the same bucket for me as every other indicator: context, not a trigger. It is two averages subtracted, so it can only tell you what the averages already told you, slightly later. Where I find it genuinely useful is as a quick read on whether a market is trending at all, because a line hugging zero and crossing back and forth is not a market for trend setups.
— Michael Whitman
This page is educational, not financial advice. Test every idea on your own charts before risking money. Some links on this page earn a commission if you buy through them. It costs you nothing and it does not decide what appears here or in what order — how these pages are made is set out in our methodology.