MACD
By LuxAlgoApr 13, 2020
The MACD computes the difference between a fast and a slow exponential moving average of the source, plotting the MACD line together with an EMA signal line and a histogram of the gap between them. Defaults follow the classic 12/26/9 configuration on a selectable source — the standard implementation of Gerald Appel's Moving Average Convergence Divergence with no modifications. The histogram plots as columns shaded four ways — rising and falling bars above zero, rising and falling below — so momentum building or fading is visible at a glance.
How to Trade the MACD?
- MACD crossing above the Signal line: momentum turning up relative to its own recent path — the fastest of the classic line-based triggers.
- MACD crossing below the Signal line: the mirrored bearish trigger, often read as a momentum exit.
- Zero-line crosses: the slow read — above zero the fast EMA sits above the slow one, a regime statement rather than a timing signal.
- Histogram shrinking toward zero: the earliest warning, showing the gap between MACD and Signal narrowing before any crossover prints.
- Divergence with price: a new price extreme the MACD line declines to confirm questions the momentum behind the move.
MACD Settings
- Fast Length (default 12): length of the fast EMA — shorter speeds every signal and every whipsaw alike.
- Slow Length (default 26): length of the slow EMA anchoring the spread.
- Signal Smoothing (default 9): EMA applied to the MACD line to obtain the signal line — lower fires crossovers earlier, higher filters them.
- Source (default close): price series used to compute the fast and slow EMAs.
Alerts
Bullish Cross and Bearish Cross alert conditions track signal-line crossings, while Bullish Zero Cross and Bearish Zero Cross track the MACD line's crossings of the zero level.
Frequently Asked Questions
Why do MACD values differ so much between instruments?
The MACD is a difference of two EMAs measured in price units, so its scale follows the instrument's price level — identical momentum can print 2 on one chart and 0.002 on another. Compare shape, crossings, and divergences across charts, never raw levels.
What are the best MACD settings?
The 12/26/9 defaults are the published standard and the common reference on every timeframe. Faster sets print earlier crossovers with more noise; slower sets suit position-scale reads with later entries.
How should MACD be combined with other tools?
A common pairing puts a trend filter in charge of direction — a long moving average or market structure — with MACD supplying timing inside that bias, taking only the signal crosses aligned with the higher-level trend.
Free indicator
Get free access to this indicator on the platforms below.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
