MOMENTUM & OSCILLATORS

MACD (Moving Average Convergence Divergence)

The gap between a fast (12) and slow (26) moving average — is momentum building or fading?

spec id: macdoutputs: line · signal · histfast (default 12) · slow (default 26) · signal (default 9)

What does MACD measure?

A momentum gauge that shows when a trend is speeding up or running out of steam. Traders watch its two lines crossing.

How is MACD calculated?

Take a fast average (12 candles) minus a slow average (26 candles) — that gap is the MACD line. Then smooth that gap over 9 candles to get the signal line it crosses. `hist` is the distance between the two.

Written by reading the engine’s real computation, not a textbook — where the two differ, the page describes what actually runs.

How do traders read MACD?

The MACD line crossing above its 9-period signal line is the classic buy; crossing below is the classic sell. The histogram is the distance between the two.

The honest caveat

Handle with care: we backtested our own MACD-cross bot honestly. In-sample it looked LIVE at +8.4% per trade. Out-of-sample it lost −1.2% — an optimism gap of +9.6 points. Textbook overfit. Combine MACD with other evidence; don't worship the cross.

How do I use MACD in a bot?

Add indicator → MACD. Three outputs you can use in rules: line, signal, hist.

Related indicators

Or browse all 158 indicators in the full library.

Build a bot that trades on MACD — the first backtest is free.

Run a free backtest