Technical analysis12 min read

What Is MACD? The Two Moving Averages in Disguise

It sits in its own panel, on its own scale, looking like independent evidence. It is a subtraction of two lines that were already on your chart.

By Pavel Penev, MScFounder, TradeWize · 10+ years trading the markets

MACD is the panel underneath the price. It has two lines and a row of bars, it has its own scale, and it moves in a way the candles above it plainly do not — which makes it look like a second source of information about the same chart. It is not. Everything in that panel was calculated from two moving averages, and if you are also watching those two moving averages up on the price, you are looking at one measurement drawn twice.

The short answer

MACD stands for Moving Average Convergence/Divergence, and it is one subtraction: the 12-day exponential moving average minus the 26-day one. That difference is the MACD line. A 9-day EMA of that line is the signal line. The bars are the distance between those two. So the MACD line crossing zero is the 12-day EMA crossing the 26-day EMA — the same event, not a confirmation of it — and the bars crossing zero is the MACD line crossing its signal line, for the same reason one level up. Gerald Appel built it in the late 1970s; Thomas Aspray added the bars in the 1980s.

12 − 26
The whole formula: one EMA minus another
1979
When Gerald Appel published it
0
Extra information beyond those two averages
32%
Of the rally below that came after MACD peaked

MACD is one subtraction

Start with the two averages. A 12-day exponential moving average is a running summary of roughly the last two and a half weeks, weighted so recent days count for more. A 26-day EMA is the same idea over about five weeks. When a price is rising, the shorter average sits above the longer one, because it has already absorbed the rise while the longer one is still carrying older, lower prices. When a price is falling, it sits below. When a price is going nowhere, the two are tangled together.

So the distance between them is a measure of something real: how strongly, and in which direction, the recent past differs from the slightly less recent past. That distance is what MACD plots. Not the price, not the averages — the space between them, moved into its own panel so it can be read against zero.

That move is the only thing the panel adds, and it is worth more than it sounds. A few dollars of separation between two averages is nearly invisible inside a twenty-six-dollar price range. Given an axis of its own, the same few dollars fills a chart. Nothing has been calculated that was not already on screen — it has been magnified, which is a real service and a limited one.

One measurement, drawn twice
THE SHADED SPACE ABOVE IS THE LINE BELOW12-EMA26-EMA$3.97 apartTHE SAME GAP, PLOTTED ON ITS OWN0MACD 3.97the dashed line is where the amber average crosses the mint one — which is this line touching zeroOne measurement, drawn twice. Nothing in the lower panel was calculated from anything the upper panel does not already show.It is bigger down there only because it has a scale of its own — which is the entire reason for moving it into a second panel.

The upper panel shades the gap between the two averages; the lower plots that same gap against zero. The white ticks are the same measurement taken at the same bars in both panels. Note how small the gap is up there — a few dollars inside a twenty-six-dollar range — and how large it is down here. That magnification is the only thing the second panel adds.

That is the whole construction, and it explains the name. "Convergence" is the two averages closing on each other, which drags the line towards zero. "Divergence" is them pulling apart, which pushes it away. The indicator is named after what the gap is doing, because the gap is the only thing it contains.

The zero line is the moving-average crossover, exactly

This follows from the arithmetic and it is worth stating plainly, because it is the single most useful thing to understand about the indicator. MACD is ema12 minus ema26. A subtraction equals zero exactly when the two things being subtracted are equal. So MACD is at zero precisely when the 12-day average and the 26-day average are at the same value — which is to say, at the moment they cross.

Not around the same time. Not usually. On the same bar, always, on every chart, on every timeframe, on every instrument. The two lists behind these charts were built separately — one by scanning for MACD passing through zero, the other by scanning for the amber average passing through the mint one — and they come back identical, bar for bar.

Which means one common habit is double-counting

If you take a moving-average crossover as a signal, and then check MACD and find it has crossed zero, you have not found agreement between two indicators. You have looked at the same fact twice and felt twice as confident about it. Fidelity's own indicator guide says as much, if you read it closely: the crossovers give signals "similar to a two moving average system". They are not similar. They are it.

Try it: measure the gap, then read the line

One chart, one cursor. Above, the white bar measures the distance between the 12-day and 26-day averages. Below, it measures the height of the MACD line above zero. Drag it anywhere you like — the two are the same number at every bar, because they are the same measurement.

The gap between the averages
$3.97above
$113.12 $109.14
What MACD reads here
3.97
signal 3.12 · histogram +0.86

Two things worth hunting for. Find the bar where the white measuring bar has no height — the averages are touching — and the lower panel is sitting exactly on zero. Then find where the amber line is far above the mint one and the lower panel is at its highest. There is no third state, because there is nothing in the bottom panel but the distance between those two lines, smoothed once more into the grey 9-day signal line, and drawn as bars.

The signal line, and the bars underneath

The MACD line moves about as much as you would expect a difference of two averages to move — which is a lot. So Appel smoothed it: the signal line is a 9-day EMA of the MACD line. It is an average of an average of the price, which is worth holding on to when you are deciding how much weight to give it. Each layer of smoothing buys steadiness and pays for it in delay.

The bars are the third part, and they are the youngest — Thomas Aspray added them in the 1980s. A bar is the MACD line minus the signal line, so the bars are tall when the two lines are far apart and shrink to nothing where they meet. Aspray's aim was to see a crossover coming: when the bars start shrinking, the lines are converging, and if they keep shrinking they will eventually touch.

Three parts, one input
What you seeWhat it isWhat it is at zero
The MACD lineThe 12-day EMA minus the 26-day EMAThe two averages are equal — the moment they cross on the price chart
The signal lineA 9-day EMA of the MACD lineNothing in particular; it crosses zero shortly after the line does
The bars (histogram)The MACD line minus the signal lineThe two lines are touching — the moment the “crossover signal” fires

Three visual elements, one price series, no extra data. Each row is the row above it, smoothed or subtracted once more — which is why they cannot disagree with each other, only lag each other.

A shrinking histogram is not a falling price

Here is the misreading that costs people the most, and it comes directly from the layering above. When the bars start getting shorter, something has definitely changed — but what has changed is the gap between two averages, not the direction of the price. A gap can narrow while both averages are still rising. A trend that slows from a sprint to a walk is still going the same way.

The translation worth memorising

Bars growing: the gap is widening — the trend is accelerating. Bars shrinking: the gap is narrowing — the trend is decelerating. Bars crossing zero: the two lines have crossed. Only the third is an event, and a car slowing down is not a car reversing.

And be careful about how much steadiness you expect from the bars. Because a bar is the distance between the line and its own smoothed version, the two touch often, and every touch flips the bars from one side of zero to the other. On the chart in the next section they cross 7 times during a single advance that ends at the highest point of the whole chart. The bars are not a slow, deliberate gauge that turns once a trend is over. They are a fast one, and most of what they report is the line catching up with itself.

Learn it by doing

Reading about it is one thing — it clicks when you do it. Practise this hands-on in a free, interactive lesson (Stage 13: Active Investing: Should You Even Bother?).

Try the free lesson →

Momentum peaks before price does, and that gap is the divergence

The one thing the panel shows that the price panel does not say out loud is a disagreement between the two. Price makes a new high; the MACD line makes a lower one. Each fresh high is being reached with a smaller gap between the averages than the last, which is a way of saying the market is working harder for less ground. That is a bearish divergence, and the mirror image — a lower low in price against a higher low in MACD — is a bullish one.

The two peaks that disagree
PRICE MADE A HIGHER HIGH. THE GAP MADE A LOWER ONE.higher high$121.30$135.32MACD LINE (VIOLET) AND ITS SIGNAL LINE (GREY)03.972.96 — lower highPrice gained 9.2% between the two highs — 32% of the whole rally — while the gap between the averages shrank.Each tick under the panel is a crossover signal. There are 7 of them inside that one advance.

The upper guide connects the two price highs and slopes up; the lower guide connects the two MACD peaks and slopes down. Between them price gained 9.2% — 32% of the entire rally — and the crossover signal fired 7 times.

Read it as one sentence and both halves of this section land at once. Momentum peaked 97 bars before price did, and over those bars price rose another 9.2% to the highest point on the chart — roughly 32% of the whole move came after the indicator's high. Anyone who read the first falling bars as an exit sold near the start of the best part. Anyone who read the divergence as a top was early by 97 bars and 9.2%.

The divergence was also, in the end, correct. Price made its second high at $135.32 against $121.30 for the first, while MACD made 2.96 against 3.97 — and what followed was a fall of 17%. That is the honest shape of divergence as a tool: it described the eventual outcome, and it was not tradeable in the meantime, because "the trend is tiring" and "the trend is over" look identical until one of them turns out to be true. StockCharts, whose reference pages are about as un-hyped as technical-analysis documentation gets, puts the caveat bluntly — bearish divergences are commonplace in a strong uptrend, and bullish ones in a strong downtrend.

The reading is in dollars, so it is not a score

RSI runs from 0 to 100, so a reading of 80 means the same thing on every chart in the world. MACD has no such scale. It is a difference between two prices, so it is denominated in whatever the instrument is denominated in — and its range is proportional to the price level.

The same shape, priced at $100 and at $1,000
SAME CHART. SAME CROSSINGS. TEN TIMES THE READING.A $100 stock$94$134MACD runs -3.9 to 4.0The same chart at $1,000$936$1341MACD runs -39.3 to 39.7The right-hand chart is the left one’s closes multiplied by ten. Every crossing lands on the same bar; every reading is ten times bigger.

The right-hand panel is the left one's closes multiplied by ten and pushed back through the same calculation. Every crossing lands on the same bar. The readings run -3.9 to 4.0 on one and -39.3 to 39.7 on the other.

Three practical consequences follow. You cannot compare a MACD value on one stock to a MACD value on another — a reading of 12 on a $900 share is a smaller move than 1.2 on a $40 one. There is no such thing as an overbought MACD level, because there is no level: the line is unbounded in both directions, and a screen for "MACD above 2" is mostly a screen for expensive shares. And a reading from the same stock five years ago is not comparable to today's if the price has doubled since.

Where it stops working, and why that is predictable

MACD is built out of moving averages, so it inherits their weakness exactly. In a range, the two averages sit on top of each other and shuffle back and forth, and the indicator fires constantly. Over the 111 flat bars that open the series these charts are drawn from, the signal line was crossed 9 times and the zero line 8 times — 17 signals in total. Price finished that stretch 1.6% from where it started.

This is not a flaw to be tuned out, and Fidelity says so on the page that documents the indicator: during trading ranges MACD will whipsaw, and users generally avoid trading in that situation. The tool measures the difference between two averages. When there is no trend, that difference is noise, and an indicator cannot report a distinction the data does not contain.

12, 26 and 9 are conventions, not constants

The defaults are Appel's, and they are on every charting platform in the world because they were on the first one. The explanation you will find repeated is that 12 was two trading weeks and 26 about a trading month, back when the market traded six days a week. It is a tidy story and the dates do not support it: the New York Stock Exchange ended Saturday trading on 29 September 1952, twenty-seven years before MACD was published.

Which is the useful fact here, rather than a piece of trivia. There is no derivation behind these numbers and there was never meant to be one. They are a sensible choice by one analyst that everybody kept, and the panel on your screen is showing you a fast average, a slow average and a smoothing — with three particular values filled in.

The same chart, four sets of parameters
SettingsWhat it isSignals it fires on our chart
5 / 35 / 5A common “faster” preset31 crossings
12 / 26 / 9Appel’s defaults — the ones on your chart23 crossings
21 / 55 / 9A slower, Fibonacci-flavoured variant20 crossings
34 / 144 / 9The “slow MACD” some swing traders use7 crossings

One unchanged price series. The parameters do not find more or fewer opportunities in it — they decide how much movement counts as a change of direction, and everything else follows from that. Faster settings are not more sensitive to the market; they are more sensitive to noise.

The temptation at this point is to search for the settings that would have worked best on the chart in front of you. It is worth knowing what the research says about that before spending a weekend on it. A 2021 study in the Journal of Risk and Financial Management ran the standard 12/26/9 model on Nikkei 225 futures from 2011 to 2019 and reported negative performance; the paper's positive results came only from parameters optimised on the same data they were then tested against. That is the shape of nearly all indicator optimisation, and it is why the numbers on your chart are still Appel's.

How to read a MACD panel in thirty seconds

  1. Find zero first. Above it, the shorter average is above the longer one and the trend is up on this timeframe; below it, down. Everything else in the panel is detail about how much.
  2. Read the distance from zero as strength, not as level. Far from zero means the two averages are far apart, which means the recent past differs sharply from the slightly less recent past. It does not mean expensive or cheap.
  3. Read the bars as acceleration. Growing means the move is speeding up; shrinking means it is slowing down. Shrinking is not falling, and this is the step most people get wrong.
  4. Treat a line crossing as one piece of evidence, not two. It is the same event as your moving-average crossover, so do not count it again.
  5. Check what the price is doing in a range. If the candles are going sideways, the panel will produce signals continuously and none of them will mean anything, which is a property of the market rather than of the settings.
  6. Never compare the number to another chart's. It is denominated in the instrument's own currency and scales with its price.

What is MACD?

MACD stands for Moving Average Convergence/Divergence. It is the 12-day exponential moving average of price minus the 26-day exponential moving average, plotted as a line in its own panel. A 9-day EMA of that line is added as a signal line, and the distance between the two is drawn as bars. It measures the gap between two moving averages, and nothing else.

How do you calculate MACD?

Take the 12-period EMA of the closing prices and subtract the 26-period EMA. That difference is the MACD line. Then take a 9-period EMA of the MACD line — that is the signal line. Subtract the signal line from the MACD line and you have the histogram. All three come from one price series and require no other input.

What does it mean when MACD crosses the zero line?

It means the 12-day EMA has crossed the 26-day EMA on the price chart — the same event, on the same bar, not a separate confirmation of it. MACD is one average minus the other, so it equals zero exactly when they are equal. Crossing up puts the shorter average above the longer one; crossing down puts it below.

Is MACD a leading or a lagging indicator?

Lagging. It is built from moving averages, and a moving average by construction summarises bars that have already happened. The histogram was designed to give a slightly earlier warning than the signal-line crossing, and it does, but earlier than a lagging signal is not the same as early. Nothing in the panel can move before the price does.

What is a MACD divergence?

A disagreement between price and the indicator. Price makes a higher high while MACD makes a lower one — meaning each new high is being achieved with a smaller gap between the two averages — or price makes a lower low while MACD makes a higher one. It is often read as an early reversal warning, and the caveat matters: divergences are common inside strong trends and can persist for a long time before anything happens.

What are the best MACD settings?

12, 26 and 9 are the defaults and there is no evidence that a better set exists in general. Faster settings produce more crossings and more false ones; slower settings produce fewer of both. Studies that find profitable parameters usually find them by optimising on the same history they then test against, which is why the results rarely survive contact with new data.

Can you use MACD and moving averages together?

Only if you understand that they are the same measurement. A 12/26 moving-average crossover on the price chart and a MACD zero-line crossing are one event described two ways, so treating them as two confirming signals is double-counting. Pairing MACD with something that measures a genuinely different thing — volume, or price structure, or the range itself — is a different proposition.

Does MACD work?

As a description of what two moving averages are doing, it works perfectly, because that is arithmetic. As a standalone buy-and-sell rule the published evidence is poor: the standard 12/26/9 model has repeatedly failed to beat simply holding the asset in academic tests. It is best understood as a way of reading trend strength quickly, not as a system.

Reading an indicator is the easy half

Knowing that a shrinking histogram means deceleration takes a minute. Sitting in front of a chart where the bars have been shrinking for three weeks, the trend is still intact, and every instinct says to act — and correctly doing nothing — is a judgement built by making the call repeatedly on charts whose ending you have not been shown. The Technical Analysis track drills exactly that.

Written by

Pavel Penev, MSc

MSc Investment & Finance, Queen Mary University of London · 10+ years trading the markets

Pavel founded TradeWize after years of trading and an MSc in Investment & Finance from Queen Mary University of London. He writes these guides to teach the decisions, not just the theory.

More about TradeWize →

Terms in this article

Keep reading