MACD: moving average convergence divergence, explained
MACD stands for moving average convergence divergence: the 12-period EMA minus the 26-period EMA. The signal line is a 9-period EMA of that MACD line, and the histogram is the gap between the two. This guide covers the maths, the classic signals and how often they work once you include costs.
Key takeaways
- MACD is the 12-period EMA minus the 26-period EMA; the signal line is a 9-period EMA of MACD.
- The histogram shows whether momentum is accelerating or slowing.
- A zero-line cross equals a 12/26 EMA crossover; signal crosses come sooner and more often.
- MACD is in price units, so divide by price to compare markets.
- Costs from frequent crossovers can outweigh the edge; always test with fees.
Where MACD comes from
Gerald Appel developed MACD in the late 1970s, and Thomas Aspray later added the histogram. The idea is simple: when a fast moving average pulls away from a slow one, momentum is building; when the two come back together, momentum is fading. MACD measures that gap directly.
The three parts
Signal line = EMA(9) of the MACD line
Histogram = MACD line − Signal line
- MACD line. Positive when the 12-period EMA is above the 26-period EMA (short-term prices above longer-term prices), negative when below. Its distance from zero is in price units, so it is not comparable between markets with different prices.
- Signal line. A smoothed version of the MACD line. Crossings between the two are the most quoted MACD signals.
- Histogram. The gap between MACD and its signal. It shrinks before a crossover happens, so traders watch it for early warning that momentum is slowing.
Worked example
Say the 12-day EMA of a stock is 105.40 and the 26-day EMA is 103.10. The MACD line is +2.30. If the 9-day EMA of recent MACD values is 1.90, the histogram is 2.30 − 1.90 = +0.40. If over the next days the MACD line stays near 2.30 while the signal line catches up to 2.20, the histogram shrinks to +0.10: momentum is still positive but no longer accelerating.
How the exponential average works
An EMA gives each new close a weight of 2 ÷ (N + 1) and the previous EMA the rest. For a 12-period EMA that is 2 ÷ 13 ≈ 15.4% on today’s close; for a 26-period EMA it is 2 ÷ 27 ≈ 7.4%. The fast average therefore reacts about twice as quickly, and the MACD line is effectively a measure of how far recent prices have run ahead of, or fallen behind, the slower trend.
The classic signals
Signal-line crossover
MACD crossing above its signal line is read as momentum turning up; crossing below as momentum turning down. These crossovers are frequent, which makes them noisy in sideways markets. Each false signal costs a round trip of fees and spread.
Zero-line crossover
MACD crossing zero is the same event as the 12-period EMA crossing the 26-period EMA. It happens less often and later, and is usually treated as a trend signal rather than a timing signal.
MACD line vs signal line vs zero line: an example
Suppose MACD moves from +0.8 to +0.6 while the signal line moves from +0.7 to +0.65. The histogram goes from +0.10 to −0.05, so MACD has crossed below its signal line. It is still above zero, which means the 12-period EMA is still above the 26-period EMA. The signal-line cross says momentum is fading; only a move through zero says the two averages themselves have crossed.
Divergence
As with RSI, price making a new high while MACD makes a lower high suggests the new high came with less momentum. Divergence can persist for a long time in strong trends, so it works better as a warning than as an entry.
Strengths and weaknesses
| Strength | Weakness |
|---|---|
| Combines trend and momentum in one view | Lags: both inputs are moving averages |
| Works on any market with closing prices | Values are in price units, not comparable across markets |
| Histogram shows acceleration and slowing | Many crossovers in sideways markets |
Settings
12, 26 and 9 come from an era of six-day trading weeks (two weeks and one month). They remain the default everywhere, so most published examples use them. Faster settings such as 5, 35, 5 react sooner; slower ones reduce whipsaws. Changing settings to fit one chart perfectly is the fastest way to build a rule that fails on the next chart. Pick a setting, then judge it on several markets.
What a MACD backtest usually shows
Run “MACD signal cross” in the backtester on a few crypto pairs and compare it with buy-and-hold over the same period. Typical patterns: in strong trends the rule catches the middle of the move but gives back part of each swing; in choppy periods it trades often, wins less than half the time and pays a lot in costs. Raising the fee from 0.1% to 0.2% per side often changes the result more than changing the parameters. That is a useful reminder that costs are part of the strategy.
Using MACD with position sizing
MACD can help decide when, but not how much. Decide the stop first, for example the most recent swing low, then let the Trade Planner size the position so a stop-out costs only the share of the account you chose. Then check that the target is far enough away for the net reward-to-risk to make sense after costs.
Reading the histogram in four phases
Most of MACD’s practical value is in the histogram, because it shows whether momentum is accelerating or fading. Each swing of the histogram usually passes through four phases:
- Rising above zero. MACD is above its signal and the gap is widening: upward momentum is accelerating.
- Falling above zero. MACD is still above its signal but the gap is shrinking: momentum is still up but slowing. Trend followers often tighten stops here rather than exit.
- Falling below zero. MACD has crossed under its signal and the gap is widening: downward momentum is accelerating.
- Rising below zero. Still below the signal, but the gap is narrowing: selling pressure is fading.
Phases two and four are the ones that warn of a possible crossover before it happens. Phases one and three tell you which side has the upper hand right now.
Normalising MACD for comparison
Because the MACD line is measured in price units, a MACD of +500 on Bitcoin and +0.002 on EUR/USD cannot be compared directly. A simple fix is to divide by the slow average and show the result as a percentage: (EMA12 − EMA26) ÷ EMA26 × 100. A reading of +2% means the fast average is 2% above the slow one, whatever the market. This version is sometimes called the percentage price oscillator. It is useful when you scan many markets, because a +2% reading on a calm currency pair is much more unusual than the same reading on a volatile coin.
A MACD checklist
- Check the direction of the zero line first: is MACD above or below zero on the timeframe above yours?
- Prefer signal-line crossovers in the direction of the higher-timeframe trend.
- Use the histogram’s shrinking phase to manage open trades, not to open new ones against the trend.
- Place stops on the price chart at a level that proves the idea wrong, then size the trade in the Trade Planner.
- Count the cost. A rule that trades 50 times a year pays 100 fees and spreads.
Comparing MACD and moving-average crossovers
A MACD zero-line cross is mathematically identical to a 12/26 EMA crossover. The signal-line cross is faster because it compares MACD with its own smoothed copy. In the backtester you can run the “EMA crossover” rule with 12 and 26 and the “MACD signal cross” rule side by side on the same market and dates. The MACD version usually trades more often, enters and exits earlier, and pays more in costs. Which one is better depends on the market’s character over that period, which is the honest answer to most indicator questions.
Where MACD appears on TradeProfy
To plot MACD lines on a chart, open Advanced Charts, select the symbol and timeframe, and enable MACD (12, 26, 9) in Indicators. Read the separate pane: the MACD line crossing its signal changes the histogram’s sign. The MACD line crossing zero means the fast EMA crossed the slow EMA. Check the closed candle before comparing signals on two timeframes.
In Advanced Charts, add MACD from the ƒx menu. It opens in a pane under the price chart with the MACD line, the signal line and the histogram coloured by phase. You can stack it with RSI in a second pane and resize both by dragging the separator, which is a common two-indicator view for momentum traders.
Key terms
- EMA
- Exponential moving average; gives the newest close a weight of 2 ÷ (N + 1).
- Signal line
- A 9-period EMA of the MACD line.
- Histogram
- MACD minus its signal line.
- PPO
- Percentage price oscillator: MACD divided by the slow EMA, comparable across markets.
- Whipsaw
- A signal quickly reversed by an opposite signal, usually in sideways markets.
Related guides
- Moving averages: EMA vs SMA and how traders use themMoving averages are the backbone of trend analysis and the building blocks of MACD and…
- RSI indicator: how it works and how traders use itThe Relative Strength Index is one of the most used and most misread indicators. This…
- How to backtest a trading strategy without fooling yourselfA backtest runs a set of rules over past prices to see what would have happened. Done…
MACD questions readers ask
What is the signal line in MACD?
The signal line is a 9-period exponential moving average of the MACD line. Because it is an average of MACD, it moves more slowly, so a crossover of MACD above or below the signal line marks a change in momentum. The histogram plots the distance between the two.
What does it mean when MACD is above zero?
The 12-period exponential average is above the 26-period one, so recent prices are on average higher than slightly older ones. It describes an upward tilt, not a forecast.
Which is better, MACD or RSI?
They measure different things. MACD tracks the gap between two averages in price units; RSI scales recent gains against losses from 0 to 100. Many traders use one for trend direction and the other for timing.
Why does the histogram change before the lines cross?
The histogram is the distance between MACD and its signal. That distance must shrink to zero before a cross, so the histogram falling toward zero shows the cross approaching.
Can I compare MACD values between Bitcoin and EUR/USD?
No. MACD is measured in the market’s own price units. Bitcoin’s MACD might be in hundreds of dollars and EUR/USD’s in fractions of a cent. Some traders divide by price to get a percentage version.
Does MACD work on intraday charts?
The maths is the same on any timeframe. Shorter timeframes have more crossovers and relatively higher costs per trade, so test with realistic fees.
What does “visual MACD” mean?
It usually refers to reading MACD from its picture rather than its numbers: the MACD line, the signal line and the histogram (the gap between them) drawn under the price chart, with colours showing whether momentum is growing or fading.
How is MACD calculated?
MACD line = 12-period EMA − 26-period EMA of closing prices. Signal line = 9-period EMA of the MACD line. Histogram = MACD line − signal line.
Where is MACD on a chart?
In a separate panel under the price chart. On TradeProfy’s charts, add it from the indicators menu.
Which MACD settings should I use?
12, 26 and 9 are the defaults most traders use and most backtests assume. Changing them changes how early and how often crossovers appear; test any change before using it.
