WOI
Market
S&P 500
7,297.07 -1.47%
Nasdaq 100
26,895.39 -2.59%
Dow Jones
50,760.79 -0.77%
VIX
21.67 +17.39%
Dollar Index (DXY)
104.97 +0.07%
Gold
3,770.90 +2.48%
Oil (WTI)
84.36 -3.02%
BTC/USD
46,199.76 +7.39%

Technical Indicators · Illustrated reference

MACD: averages, signal and histogram

Construct three related quantities from one price series.

Read, watch or explore. No exercises, scores or required progression.

Animated explanation · synthetic observations

MACD: direction, separation and changing momentum

Sideways price produces repeated signal and zero crossings with weak follow-through. The same calculation can describe noise as well as a trend; a crossover is not proof of profitable execution.
Sideways failure

Sideways price produces repeated signal and zero crossings with weak follow-through. The same calculation can describe noise as well as a trend; a crossover is not proof of profitable execution.

Original synthetic observations. Captions explain purpose, price relationships and failure; calculations use the displayed inputs. The complete reference is shown when motion is unavailable. Playback is optional.

Read the complete animated explanation

Complete momentum cycle

  1. Price acceleration: Price begins accelerating upward. EMA5 reacts sooner than EMA13. MACD is their vertical difference, expressed in price units; it does not measure price level.
  2. EMA separation expands: The underlying EMAs separate as the advance strengthens. MACD expands and rises above its EMA4 signal. The positive histogram measures this additional separation from the signal.
  3. Price still rises; histogram contracts: Price is still rising, but its upward increments shrink. The positive histogram contracts as MACD loses momentum relative to its signal. A smaller positive bar does not mean price is falling.
  4. Signal crossover before price reversal: MACD crosses below its signal while price may still rise. The histogram becomes negative, but MACD can remain above zero: fast EMA is still above slow EMA. These are different comparisons.
  5. Zero-line reversal: Price reverses and the fast EMA eventually falls below the slow EMA. MACD crosses zero. The signal and histogram respond on their own smoothing clocks; none guarantees the next return.
  6. Sideways failure: Sideways price produces repeated signal and zero crossings with weak follow-through. The same calculation can describe noise as well as a trend; a crossover is not proof of profitable execution.

Sideways crossovers

  1. Price acceleration: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
  2. EMA separation expands: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
  3. Price still rises; histogram contracts: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
  4. Signal crossover before price reversal: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
  5. Zero-line reversal: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
  6. Sideways failure: Sideways price repeatedly changes the EMA difference and histogram sign. A zero crossing compares the price EMAs; a signal crossing compares MACD with its smoother. Neither guarantees useful follow-through.
In this reference
  1. MACD measures the separation of two smoothed price series
  2. Build the calculation in three connected panels
  3. A short ledger that can be checked by hand
  4. Warm-up occurs at more than one layer
  5. Zero crossings and signal crossings answer different questions
  6. MACD atlas: positive, negative and misleadingly familiar shapes
  7. Parameters change the filter, not only the label
  8. Calculation conventions and limitations
  9. Method attribution and implementation reference

MACD measures the separation of two smoothed price series

Moving Average Convergence/Divergence, associated with Gerald Appel, subtracts a slower exponential moving average from a faster one. A signal line smooths that difference. The histogram subtracts the signal line from the MACD line. These are three related quantities, not three independent sources of information.

The commonly encountered parameter set is 12, 26 and 9, but a period counts supplied observations. Daily MACD and hourly MACD with the same parameters describe different horizons. The period set is a convention, not a universally optimal configuration.

Fast Fₜ = EMA_fast(P)ₜ
Slow Sₜ = EMA_slow(P)ₜ
MACD Mₜ = Fₜ − Sₜ
Signal Qₜ = EMA_signal(M)ₜ
Histogram Hₜ = Mₜ − Qₜ

The underlying moving averages use the same price units as their input; so do their differences. A MACD value of 2 on a stock priced near 20 is not directly comparable with 2 on a stock priced near 500. Percentage-normalized oscillators are different calculations and need their own denominator and edge-case rules.

Build the calculation in three connected panels

The illustration first identifies the fast and slow average values on the price panel, then transfers their vertical difference to the MACD panel. It subsequently shows the distance between MACD and its signal line as the histogram. Every line and bar is calculated from the same synthetic closes.

The chart uses shorter periods 3, 5 and 3 to make the mechanism visible in a compact series. It does not label those outputs as 12/26/9. The calculation begins with first-value seeds for both price EMAs; the signal seed is the first resulting MACD value. This choice is explicit so that the example is reproducible.

A short ledger that can be checked by hand

Take closes 100, 102, 104 and use fast period 3, slow period 5 and signal period 3. Their smoothing factors are 1/2, 1/3 and 1/2. Starting both price EMAs at 100 makes the first MACD and signal values zero.

CloseFast EMA3Slow EMA5MACDSignal EMA3Histogram
100100100000
102101100.6666670.3333330.1666670.166667
104102.5101.7777780.7222220.4444440.277778

For the third observation, the fast average is 0.5×104+0.5×101=102.5. The slow average is (1/3)×104+(2/3)×100.666667≈101.777778. Their difference is approximately 0.722222. Applying the signal recursion and subtracting it yields the displayed histogram. Internal calculations retain precision; the table rounds only for display.

Warm-up occurs at more than one layer

An implementation using arithmetic-mean seeds must first obtain enough prices for its price averages. It then needs enough defined MACD values to seed the signal average. Different implementations can align the fast seed relative to the slow window differently; a generic formula alone does not certify bit-for-bit parity.

Under a particular convention where the slow EMA first appears at index slow−1 and the signal needs signal defined MACD values, the first histogram appears at index slow+signal−2. That is an illustration of the dependency chain, not a universal output-index promise for every library.

First-value initialization produces earlier numbers but does not create more historical information. More warm-up reduces seed effects under the same subsequent inputs. Missing observations, data revisions and truncating the history can change outputs. Compare implementations only after these choices are aligned.

Zero crossings and signal crossings answer different questions

When MACD crosses zero, the fast and slow price averages exchange order. When the histogram crosses zero, MACD and its signal line exchange order. A positive histogram can occur while MACD remains negative: the fast price average is still below the slow one, but their difference is above its own smoothed reference.

A declining positive histogram means the MACD-to-signal separation is shrinking, not necessarily that price is falling. A negative histogram does not require a negative close-to-close return on every bar. Each transformation has memory and a different comparison baseline.

Calling the histogram “acceleration” can be a loose analogy, but it is not a physical second derivative of price. Its exact meaning is the difference of an EMA difference and a smoothed version of that difference. Interpret the formula before adopting the metaphor.

MACD atlas: positive, negative and misleadingly familiar shapes

Steady advance

Fast EMA above slow EMA gives positive MACD. A stable positive MACD can coexist with a small histogram as the signal catches up.
Fast EMA above slow EMA gives positive MACD. A stable positive MACD can coexist with a small histogram as the signal catches up.

Slowing advance

The closes continue rising while their increments shrink. A declining or negative histogram does not require falling prices.
The closes continue rising while their increments shrink. A declining or negative histogram does not require falling prices.

Reversal

Price reverses before every smoothed relationship has completed its transition. Zero and signal crossings occur under different comparisons.
Price reverses before every smoothed relationship has completed its transition. Zero and signal crossings occur under different comparisons.

Alternating

The histogram changes sign repeatedly in this alternating path. Crossings are descriptions, not independent evidence of investment value.
The histogram changes sign repeatedly in this alternating path. Crossings are descriptions, not independent evidence of investment value.

The steady advance establishes positive separation. The slowing advance can reduce the histogram while closes still rise. The reversal changes both the input direction and the lagged relationships over time. The alternating path demonstrates frequent changes around zero without a sustained directional opportunity.

A zero-crossing event is an observation, not a promise. A rule that acts on it must specify completion time, equality handling, order timing, costs and exits. A small histogram change near zero can reflect ordinary input movement or numerical differences; the magnitude and implementation tolerance matter.

Parameters change the filter, not only the label

Shortening periods increases the response to recent observations under the conventional EMA parameterization. It also changes the amount of smoothing and the frequency of crossings. Increasing the signal period makes its reference smoother, but can leave a larger difference during a transition. No parameter change creates independent information.

Adding a constant to every price leaves MACD unchanged under compatible initialization because the constant cancels between the price averages. Multiplying prices by a positive factor scales MACD, signal and histogram by that factor. This explains why absolute amplitudes should not be compared across incompatible price scales.

Divergence compares selected price extrema with selected indicator extrema. Pivot pairing and recognition delays need explicit rules. A weaker indicator extreme can coexist with further price gains; divergence geometry alone does not validate a reversal forecast.

Calculation conventions and limitations

The examples use recursive exponential moving averages initialized from the first price. MACD values can differ when platforms use different price histories, initialization methods or data conventions. Compare these settings before interpreting differences between indicator readings.

MACD is derived from price, so combining it with moving-average direction can repeat much of the same information. It does not measure valuation, order-book liquidity or expected return. A successful illustration is not a backtest. Continue with moving-average weighting and initialization, regime uncertainty, and a different normalization of price changes.

Method attribution and implementation reference

Gerald Appel is credited with MACD; his published methodology is distinct from this chapter’s original diagrams and synthetic examples. The TA-Lib MACD implementation documentation, reviewed 3 December 2026, records the output definitions and parameter behavior. It is an implementation reference, not evidence that the educational examples produce investment value.