MACD explained

BEGINNER·15 min read·Reviewed 17 October 2026·Technical Analysis

What you will learn

  • What the MACD line, the signal line and the histogram are, and how to calculate each from closing prices.
  • Why the MACD line crossing zero is exactly the same event as a 12/26 EMA crossover, which we checked on five instruments.
  • How the signal-line crossover works, and how often it flips: in our test, about 100 to 125 reversals in five years.
  • What a published test and our own always-in-the-market test of the standard 12/26/9 rule show, including how it compared with buying and holding.

The idea in plain words

The previous lesson showed that a moving average smooths price and lags it. If you take a fast average and a slow average, the gap between them tells you something: when price has been rising, the fast average is above the slow one, and the faster the rise, the wider the gap. MACD (moving average convergence divergence) is exactly that gap, drawn as a line under the chart: the fast average minus the slow average.

The name describes what the gap does. When the two averages move apart, they diverge, and the MACD line moves away from zero. When they move toward each other, they converge, and the line heads back to zero. So MACD is a picture of the momentum of the trend: far from zero means a strong move, close to zero means the two averages agree, and crossing zero means the fast average has changed sides.

Britannica’s guide to the indicator says it was developed in the late 1970s by the technical analyst Gerald Appel, who designed it to identify trends, measure the momentum behind them and generate signals at points of acceleration. Today it appears on nearly every charting platform, almost always with the same default settings of 12, 26 and 9.

How it works

The three parts

With the usual settings, MACD has three components:
1. The MACD line = EMA(12) − EMA(26) of the closing prices. It is in price units: for EUR/USD, a value of 0.00081 is 8.1 pips.
2. The signal line = a 9-period EMA of the MACD line. It is a smoothed copy of the MACD line, so it lags it.
3. The histogram = MACD line − signal line. It is positive when the MACD line is above its signal line and negative when below, and its height shows how far apart they are.

The EMA calculation was in the previous lesson: new EMA = previous EMA + α × (close − previous EMA), with α = 2 ÷ (n + 1). For n = 12, α = 2 ÷ 13 = 0.1538. For n = 26, α = 2 ÷ 27 = 0.0741. For the signal line, n = 9, so α = 2 ÷ 10 = 0.2.

Two crossovers, two meanings

Zero-line crossover. The MACD line crosses zero exactly when the 12-period EMA crosses the 26-period EMA, because the line is their difference. This is not an approximation. We checked it on the daily candles of five instruments and every zero-line crossing fell on the same day as a 12/26 EMA crossover: EUR/USD 40 crossings in both counts, GBP/USD 47, USD/JPY 46, gold 46, Bitcoin 45. So the MACD zero line adds nothing to a 12/26 EMA crossover rule. It displays the same event differently.

Signal-line crossover. The MACD line crossing its own signal line is a different, earlier and more frequent event. Because the signal line is a smoothed, lagging version of the MACD line, the MACD line crosses it whenever the momentum of the trend changes direction, even while both are still above (or below) zero. This is the crossover most traders mean by “MACD signal”, and it is more sensitive: it flips more often.

The histogram

The histogram is positive when the MACD line is above the signal and negative when below. It crosses zero at exactly the moments of the signal-line crossover. A rising histogram means the MACD line is pulling away from its signal, and a shrinking histogram means they are converging, which is often described as momentum fading. Like everything built from averages of past closes, it describes the past. It does not forecast.

What the research says

  • Chong and Ng (Applied Economics Letters, 2008) tested the MACD and RSI rules on 60 years of data for the London Stock Exchange FT30 index and report that both rules could generate returns higher than buy and hold in most cases. This is evidence for a stock index over a long history, not for a forex pair or a CFD today.
  • Park and Irwin (Journal of Economic Surveys, 2007) surveyed the technical-analysis literature: of 95 modern studies, 56 found positive results, 20 negative and 19 mixed, with data snooping, rules chosen after the fact and weak handling of costs as the main warnings.
  • Sullivan, Timmermann and White (Journal of Finance, 1999) applied a data-snooping correction to a large universe of rules on the Dow Jones index, the kind of check any rule such as MACD should face.

Our own test, and its limits

We tested the standard MACD(12, 26, 9) signal-line rule on daily candles of five instruments from the demo feed we use. The rule was fixed in advance and never tuned: long while the MACD line is above its signal line, short while below, always in the market, entering at the next day’s open after the signal at the close. We charged an assumed cost at each reversal (0.01% of price for the forex pairs, 0.02% for gold and 0.05% for Bitcoin, our assumptions and not broker quotes).

Our own test, and its limits
Instrument Period starts Reversals Result with cost Trades won Largest fall from a peak Buy and hold, same period
EUR/USD 23 Feb 2021 125 −5.9% 40% −16.9% −8.3%
GBP/USD 23 Feb 2021 98 +19.4% 49% −8.9% −6.2%
USD/JPY 23 Feb 2021 123 −3.0% 31% −25.7% +50.6%
XAU/USD (gold) 11 Feb 2021 120 +15.0% 36% −30.8% +122.7%
BTC/USD 6 Oct 2022 111 +6.9% 37% −55.8% +308.1%

All periods run to 15 October 2026. What this shows, and does not:
– The rule reversed about 100 to 125 times in roughly five years, about twice a month. Only 31% to 49% of its trades made money.
– Two of the five instruments made money relative to buying and holding (EUR/USD and GBP/USD, where buying and holding lost), and three trailed it by a wide margin (USD/JPY, gold and Bitcoin), because in strong one-directional markets a rule that flips often misses a lot of the trend.
– The assumed costs mattered more than in the slower moving-average test: for Bitcoin the result fell from +13.0% before costs to +6.9% after them. A rule that trades twice a month pays the spread twice a month.
– Five instruments, one feed, one regime and no tuning is a small test. It is an illustration, not evidence for or against MACD.

Worked examples

Example 1: calculate MACD by hand

These are the last six 4-hour closes of EUR/USD on the demo feed, oldest first: 1.12140, 1.12070, 1.12188, 1.12124, 1.12290, 1.12451. We start from the values the engine gave for the previous candle, EMA(12) = 1.12040 and EMA(26) = 1.11988, and the MACD line and signal values of the previous four candles in pips: MACD 1.99, 3.06, 5.19, then the new value; signal −4.55, −3.03, −1.38, then the new value.

  1. New EMA(12) = 1.12040 + (2 ÷ 13) × (1.12451 − 1.12040) = 1.12040 + 0.1538 × 0.00411 = 1.12040 + 0.00063 = 1.1210.
  2. New EMA(26) = 1.11988 + (2 ÷ 27) × (1.12451 − 1.11988) = 1.11988 + 0.0741 × 0.00463 = 1.11988 + 0.00034 = 1.1202.
  3. MACD line = 1.1210 − 1.1202 = 0.0008, which is 8.1 pips. The engine’s more precise value is 8.08 pips.
  4. New signal = previous signal + 0.2 × (MACD − previous signal) = −1.38 + 0.2 × (8.08 + 1.38) = −1.38 + 1.89 = 0.51 pips.
  5. Histogram = 8.08 − 0.51 = 7.57 pips.

The MACD line is above zero (the 12-period average is above the 26-period) and above its signal, so by the usual reading momentum is up. The MACD line rose from 1.99 to 8.08 pips over four candles while the histogram stayed between 6.1 and 7.6, so the MACD line was pulling away from its signal at a steady rate.

EUR/USD 4-hour candles with EMA(12), EMA(26) and the MACD panel; last candle MACD 8.08, signal 0.51, histogram 7.57
What to notice: That the MACD line equals the gap between the two EMAs on the price chart.

Example 2: twelve real signal-line crossovers

This is the real sequence of MACD(12, 26, 9) signal-line crossovers on EUR/USD daily candles from December 2025 to August 2026 (the rule of the test above), each trade entered at the next day’s open and held until the opposite crossover, before costs:

Example 2: twelve real signal-line crossovers
Signal date Direction Entry Exit Result Held (candles)
31 Dec 2025 Short 1.17466 1.17483 −1.7 pips 15
22 Jan 2026 Long 1.17483 1.17769 +28.6 pips 10
5 Feb 2026 Short 1.17769 1.18933 −116.4 pips 3
10 Feb 2026 Long 1.18933 1.18627 −30.6 pips 2
12 Feb 2026 Short 1.18627 1.16112 +251.5 pips 27
23 Mar 2026 Long 1.16112 1.17197 +108.5 pips 25
27 Apr 2026 Short 1.17197 1.17464 −26.7 pips 9
8 May 2026 Long 1.17464 1.17070 −39.4 pips 3
13 May 2026 Short 1.17070 1.16067 +100.3 pips 24
16 Jun 2026 Long 1.16067 1.14999 −106.8 pips 1
17 Jun 2026 Short 1.14999 1.14330 +66.9 pips 12
3 Jul 2026 Long 1.14330 1.15768 +143.8 pips 40
  1. Twelve trades, six winners and six losers, a net of +378.0 pips before costs. The latest crossover, on 28 August 2026, put the rule short.
  2. The winners and losers are very different in size and in length. The biggest winner (+251.5 pips) was held 27 candles, and four of the six losers lasted three candles or fewer.
  3. Between 5 and 12 February the rule went short, long and short again within a week: a loss of 116.4 pips, a loss of 30.6 pips, and then the +251.5-pip winner. A trader who gave up after the first reversal would have missed the winner. A trader who followed every signal paid for the two losers.
  4. 16 and 17 June show the other face of a sensitive signal: a long entered at 1.16067 was reversed after one day for −106.8 pips, and the next trade, short from 1.14999, made +66.9 pips.

EUR/USD daily candles, January to August 2026, with the MACD panel and twelve crossovers marked long or short
What to notice: That crossovers cluster in sideways stretches and that one signal can reverse within a day or two.

How to apply it step by step

  1. Add MACD(12, 26, 9) to the chart and find the three parts: the MACD line, the signal line and the histogram.
  2. Note whether the MACD line is above or below zero. That tells you which side of the slow EMA the fast EMA is on.
  3. Note whether the MACD line is above or below its signal line, and whether the histogram is growing or shrinking.
  4. Check the trend first, using swings or the ADX. Signal-line crossovers inside a range flip back and forth.
  5. Decide in advance what a crossover means to you (a signal, a filter, or context) and write it in your plan.
  6. If you test a rule, fix the settings and the cost assumption first, count the reversals, and compare with buy and hold for the same period.
  7. Compute the cost of reversals: reversals per year multiplied by your cost per trade.

Common mistakes

  • Treating the zero line and the 12/26 crossover as two signals. They are the same event.
  • Trading every signal-line crossover in a range. In our test the rule reversed about twice a month, and fewer than half of the trades won.
  • Reading the histogram as a forecast. A shrinking histogram describes converging averages, not a coming reversal.
  • Optimising the settings. Trying many combinations and keeping the best is data snooping.
  • Ignoring costs. A rule that flips about 100 times in five years pays the spread about 100 times.
  • Ignoring the lag. MACD is built from two lagging averages, so every signal comes after the move has begun.

When it works and when it does not

MACD works as a compact display of the gap between two averages, and as a repeatable rule you can test. It is most informative in a trending market, where the MACD line stays on one side of zero and pulls away, and least useful in a range, where the lines weave around each other and each crossover is late and small.

The evidence is mixed. One published test of MACD and RSI rules on a stock index over 60 years found returns above buy and hold in most cases, a large survey found the literature mixed and warned about data snooping and costs, and our small test found the standard rule behind buy and hold on three of five instruments and heavily reliant on cost assumptions. The settings 12, 26 and 9 became standard by adoption, and there is no reason in our evidence to think they are best. Use MACD to describe momentum, and test any rule built from it with costs and fresh data.

Practice exercise

  1. EMA(12) is 1.2050 and EMA(26) is 1.2030. What is the MACD line in pips?
  2. The previous signal value was 8.0 pips and the new MACD value is 12.0 pips. With α = 0.2, what is the new signal and the histogram?
  3. The MACD line moves from 2.0 pips to −1.0 pips in one candle. What happened to the two EMAs?
  4. Why can a signal-line crossover occur while the MACD line is still above zero?

Answers:
1. MACD = 1.2050 − 1.2030 = 0.0020 = 20 pips.
2. New signal = 8.0 + 0.2 × (12.0 − 8.0) = 8.8 pips. Histogram = 12.0 − 8.8 = 3.2 pips.
3. The MACD line crossed zero, which means the 12-period EMA crossed below the 26-period EMA.
4. The signal line is a smoothed, lagging copy of the MACD line, so the MACD line can fall below it, when momentum fades, before the fast EMA has fallen below the slow EMA.

Key terms

MACD – moving average convergence divergence: the 12-period EMA minus the 26-period EMA of closes.
Signal line – a 9-period EMA of the MACD line.
Histogram – the MACD line minus the signal line.
Zero-line crossover – the MACD line crossing zero, which is the same event as the 12 and 26 EMAs crossing.
Signal-line crossover – the MACD line crossing its signal line.
Convergence / divergence – the two averages moving toward / away from each other.
Reversal – a change of position from long to short or the reverse.
Data snooping – finding rules that look good by trying many settings until some work by chance.

Frequently asked questions

What does MACD stand for?

Moving average convergence divergence. It is the difference between a fast and a slow exponential moving average, which converge when momentum fades and diverge when a trend strengthens.

How do you calculate MACD?

Subtract the 26-period EMA of the close from the 12-period EMA. That is the MACD line. The signal line is a 9-period EMA of the MACD line, and the histogram is the MACD line minus the signal line.

What is a MACD crossover?

Either the MACD line crossing its signal line (the more frequent signal) or crossing zero (the same event as the 12 and 26 EMAs crossing). The signal-line crossover flipped about twice a month in our daily test.

Does MACD work?

The evidence is mixed. One study found MACD rules beat buy and hold on a stock index over 60 years, a major survey found the literature mixed, and in our five-instrument test the standard rule trailed buying and holding on three of five.

Are 12, 26 and 9 the best MACD settings?

No evidence shows that they are. They are the long-standing default, and results change with the settings, so choose them before you look at results and test them with costs.

Is MACD better than RSI?

They measure different things: MACD measures the gap between two averages, and RSI measures how one-sided recent changes were. Neither has been shown to be better, and both are built from past prices.

Key takeaways

  • MACD line = EMA(12) − EMA(26). Signal = EMA(9) of MACD. Histogram = MACD − signal.
  • The MACD zero-line crossing is exactly the 12/26 EMA crossover, which we confirmed on five instruments.
  • The signal-line crossover is more frequent: about 100 to 125 reversals in five years in our test, with fewer than half of trades winning.
  • In our test the rule beat buy and hold on two of five instruments, trailed it on three, and the result depended on cost assumptions.
  • MACD describes momentum from past closes. Test any rule built on it with costs and fresh data.

Quick quiz

Q1. EMA(12) is 1.0850 and EMA(26) is 1.0870. What is the MACD line, and is it above or below zero?
A: 1.0850 − 1.0870 = −0.0020 = −20 pips, below zero.

Q2. Previous signal 5.0, new MACD 10.0, α = 0.2. What is the new signal?
A: 5.0 + 0.2 × (10.0 − 5.0) = 6.0.

Q3. What does it mean when the MACD line crosses zero?
A: The 12-period EMA has crossed the 26-period EMA.

Q4. The histogram is positive and growing. What does that describe?
A: The MACD line is above its signal and pulling further away. It is a description of past momentum, not a forecast.

Q5. Why does a sensitive signal increase costs?
A: It reverses more often, so the spread and any commission are paid more often.

Q6. Why is our five-instrument result not proof that MACD fails?
A: It is a small test on one feed over one period with assumed costs and fixed settings, so it is an illustration and not a general conclusion.

Going deeper

Educational content only, not financial advice. Trading involves substantial risk of loss.