MACD Calculator (Moving Average Convergence Divergence)

Calculate MACD line, signal line, and histogram from fast and slow EMAs.
Standard 12/26/9 settings or any custom periods for trend trading.

MACD line

Gerald Appel built MACD in the late 1970s. The recipe is three exponential moving averages stacked together:

  • MACD line = 12-period EMA - 26-period EMA
  • Signal line = 9-period EMA of the MACD line
  • Histogram = MACD line - Signal line

The 12/26/9 numbers are convention but not gospel. Day traders run 5/13/5. Weekly chart traders sometimes use 19/39/9. The key relationship, fast minus slow smoothed by a signal line, is what generates the readings, not the specific numbers.

Three signals come from one indicator.

  1. Zero-line cross: MACD crossing above 0 means the fast EMA crossed above the slow EMA. It is the same kind of event as a golden cross, though not literally one: a golden cross is the 50-day crossing the 200-day, on much slower averages.
  2. Signal cross: MACD crossing above its signal line is a faster, noisier momentum trigger. Short-term traders use this; trend followers ignore it.
  3. Histogram divergence: when price makes a new high but the histogram makes a lower high, momentum is fading. This is the classic divergence setup.

Why MACD lags everything. It is a moving average of a moving average. By the time the signal line crosses, price has often already moved 30 to 50% of the next swing. Use MACD for confirmation in trending markets and avoid it in chop, where it whipsaws hard as price grinds sideways.

The histogram is the early-warning system. The histogram peaks before the signal cross. If the bars are getting shorter while price climbs, the cross is coming. Watch the histogram, not the line.

MACD is not comparable between instruments, and this catches people out. The reading is a raw price difference, so a MACD of 0.80 is a large move on a $50 stock and meaningless on a $5,000 index. The same indicator on the same day gives a hundred times the number on the index. To compare across instruments, or to compare one instrument against its own history after a big run, divide by price: 0.80 on a $50 stock is 1.6%, and that figure travels. The result panel works it out for you if you supply the price.

Worked example. Stock at $50. 12-EMA = 49.20, 26-EMA = 48.40, 9-EMA of the MACD line = 0.65.

  • MACD line = 49.20 − 48.40 = 0.80
  • Signal = 0.65
  • Histogram = 0.80 − 0.65 = 0.15, positive
  • As a share of price = 0.80 / 50 = 1.6%

Interpretation: short-term momentum is bullish, the signal cross has already fired, and the histogram is positive. Whether it is expanding is the thing you cannot tell from one reading, which is why the calculator takes an optional previous histogram value. If the last bar was 0.22 and this one is 0.15, momentum is fading even though everything still looks bullish, and that is the divergence setup worth acting on.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.