What Is MACD? DIF, DEA, the Histogram and the Golden Cross
Reads momentum from the gap between the 12 and 26-day exponential averages (DIF) and its 9-day average (DEA). DIF crossing above DEA is a golden cross; the histogram is their difference, and only its sign compares across stocks.
Contents (5 sections)
MACD (Moving Average Convergence Divergence) shows whether a stock's short-term momentum is running ahead of or behind its longer-term momentum. It is three numbers, not one: the DIF line, the DEA line, and the histogram, which is the gap between them.
How it is calculated
- DIF is the 12-day exponential moving average of the close minus the 26-day one. When recent prices are rising faster than the longer average, DIF is positive and climbing.
- DEA is the 9-day exponential moving average of DIF. It is DIF smoothed, so it turns later. Western charts call it the signal line.
- The histogram is DIF minus DEA. It is positive while DIF is above DEA and negative while it is below.
Some charting software in China draws the histogram at twice this size. The sign and the turning points are the same; only the height differs.
Reading it
| What you see | What it usually means |
|---|---|
| DIF crosses above DEA (histogram turns positive) | A golden cross: short-term momentum has overtaken its own average |
| DIF crosses below DEA (histogram turns negative) | A dead cross: momentum is fading |
| DIF above zero | The 12-day average is above the 26-day one: the medium trend is up |
| A cross while DIF is above zero | Momentum resuming inside an uptrend |
| A cross while DIF is below zero | A bounce inside a downtrend, which fails more often |
A bullish divergence is when price makes a lower low while DIF at the new golden cross is clearly higher than at the previous one: price fell further but momentum fell less.
What it does not tell you
- How big the move is, across stocks. DIF, DEA and the histogram are in price units. The same pattern reads about 0.09 on a 12-dollar stock and about 8.7 on a 1,200-dollar one. Only the sign compares across stocks; a threshold such as "histogram above 0.5" means different things for different prices.
- Anything quickly. MACD is built from averages of averages. By the time a golden cross appears, part of the move has happened.
- Much in a sideways market. With no trend, DIF and DEA cross back and forth and most crosses lead nowhere. ADX says whether there is a trend for MACD to describe.
In Stock Compass
MACD is a family of rule indicators under Trend & Momentum:
- macd_hist: the histogram, DIF minus DEA. Use it for direction only: greater than 0 or less than 0.
- macd_hist_pct: the histogram as a percentage of the share price, which does compare across stocks.
- macd_dif and macd_signal: the DIF and DEA lines; greater than 0 means above the zero axis.
- macd_golden_cross_days: trading days since the last golden cross; 0 is today, 3 or less is fresh. With no cross in the window the condition is simply not met.
- macd_bullish_divergence: true when the divergence described above is present, counting only crosses below the zero axis.
A cross above the zero axis is written as two conditions: golden-cross days of 3 or less, and DIF greater than 0. Turn your logic into buy rules shows how conditions combine.
FAQ
Is a MACD golden cross a buy signal?
It is a description, not an instruction: short-term momentum has moved above its own average. Crosses above the zero axis in a trending stock have a better record than crosses below it or in a sideways market, and the only way to know how they did on your own stocks is to backtest the rule.
Why is my MACD histogram half the size of the one in my broker's app?
Some software, common in China, plots the histogram as two times DIF minus DEA. Stock Compass uses DIF minus DEA. The sign and the days it turns are identical.
Which MACD settings does Stock Compass use?
The standard 12, 26 and 9: a 12-day and a 26-day exponential average for DIF, and a 9-day exponential average of DIF for DEA, on daily bars.
Definition only — not investment advice.