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
- MomentumHow much the price has changed over a set stretch, as a fraction.
- Polarized frac effHow efficiently price is travelling, with a sign attached: strongly positive means a clean move up, strongly negative a clean move down, near zero means wandering.
- Pretty good oscillatorHow far price has stretched from its average, measured in units of its own typical daily move.
- Price momentum oscA smoothed momentum line built to be comparable across different stocks, so you can rank a whole watchlist by it.
Or browse all 158 indicators in the full library.