MACD
The MACD line (DIF), the signal line (DEA) and the histogram: using the gap between two EMAs to measure the direction and strength of a trend.
Every lesson has an interactive simulation you can drag and play, plus a quick quiz. Sign up free to use them and save your progress automatically. Here is the text version of this lesson.
Not sure yet? Try the first lesson (no sign-up needed)「Simple Moving Average (SMA)」。
Text version · Trend Indicators, lesson 4: “MACD”
The MACD line (DIF), the signal line (DEA) and the histogram: using the gap between two EMAs to measure the direction and strength of a trend.
DIF: the gap between two EMAs
DIF = fast EMA − slow EMA; above the zero line means the short term is stronger than the long term. DEA is a smoothed DIF. DIF crossing above DEA is a bullish signal, stronger when it happens above the zero line.
Histogram: momentum's thermometer
MACD histogram = DIF − DEA. The bars flipping from negative to positive means DIF crossed above DEA; bars getting shorter one after another mean momentum is fading, often before price turns.
Tangling near the zero line
A golden cross above the zero line usually carries more weight than one below it. In a sideways market DIF hugs the zero line and keeps crossing DEA, so signal quality is poor. MACD is built from moving averages, so it lags too.
Key takeaways
- MACD line (DIF) = EMA12 − EMA26; signal line (DEA) = the 9-period EMA of the MACD line; histogram = MACD line − signal line (some Chinese software draws the bars at 2x, same shape).
- The MACD line crossing above the signal line (histogram turning from negative to positive) is a bullish signal, usually carrying more weight above the zero line.
- A shrinking histogram means momentum is fading, often before price turns, though it may just be a pause.
- MACD is built from moving averages, so it lags too. In a sideways market, the MACD line hugs zero and keeps crossing the signal line, and signal quality is very low.
Try it yourself
You can do these exercises in this lesson's interactive simulation:
- Hover over the bar where the histogram turns from red to green: what happened to DIF and DEA?
- Switch to "Sideways range": how many "DIF/DEA crossovers" are there? Compared with "Rally, then fall," is DIF far from or close to the zero line?
- Turn on "Fading momentum detection" and switch to "Rally, then fall": before the top, where do the amber boxes appear? What does price do afterwards?
- Change the signal line from 9 to 3 and to 15: how does the number of crossovers change? Is more sensitive always better?
Quiz and explanations
- 1. The MACD histogram turns from negative to positive. What does that mean?
- Answer: The MACD line crossed above the signal line, and momentum is strengthening.Histogram = MACD line − signal line, so turning positive means the MACD line crossed above the signal line.
- 2. What does it mean when the MACD line is above the zero line?
- Answer: EMA12 is above EMA26, so the short term is strong.The MACD line is simply the gap between the two EMAs.
- 3. In a sideways market, the MACD and signal lines hug the zero line and keep crossing. What's the most sensible approach?
- Answer: Treat these crosses as low-quality signals and wait for a trend.Without a trend, MACD crosses whipsaw just like moving average crossovers.
Terms in this lesson
- lag (Lag): Because indicators are built from past prices, their signals always come after the actual turn in price.
- MACD: An indicator that measures trend and momentum using the gap between EMA12 and EMA26 (the MACD line) and its signal line.
- MACD histogram (Histogram): The gap between the MACD line and its signal line; longer bars mean momentum is building, shorter bars mean it's fading.