Momentum indicators
Moving Average Convergence/Divergence
Difference between fast and slow moving averages with signal and histogram outputs.
- Engine
- TA-Lib
- Function
MACD- Input series
- close
- Outputs
- 3
How it works
MACD computes the difference between fast and slow moving averages of close, then computes a signal line over that MACD series. The histogram is the difference between MACD and the signal line.
Use case
Use MACD as a multi-output momentum and trend-change feature that captures moving-average convergence and divergence.
Parameters
| Parameter | Type | Default | Bounds or options | Description |
|---|---|---|---|---|
| Fast Period | integer | 12 | 2…100000 | Period for the faster moving average. |
| Slow Period | integer | 26 | 2…100000 | Period for the slower moving average. |
| Signal Period | integer | 9 | 1…100000 | Period used to smooth the MACD line into the signal line. |
Outputs
| Output | Type | Description |
|---|---|---|
| MACD | number | MACD line value for the bar. |
| MACD Signal | number | Signal line value for the bar. |
| MACD Histogram | number | Difference between the MACD line and signal line for the bar. |
Reading the result
MACD describes the separation between a faster and a slower smoothed price baseline. Its signal output smooths that separation, while the histogram represents the difference between the main and signal lines.
Zero-line position, line crossings, histogram sign, and histogram change answer different questions. Preserve them as separate features instead of reducing the entire indicator to one crossover event.
Common mistakes
- Using a fast horizon that is not actually shorter than the slow horizon.
- Comparing raw MACD magnitude across assets with very different price levels.
- Treating histogram growth as direct price acceleration without considering the smoothing chain.
- Comparing implementations without identical source history and initialization.
DataCat workflow notes
MACD has several persisted outputs. Use the deterministic output mapping in indicator_definitions. If cross-asset comparability matters, create an explicitly normalized downstream feature rather than changing the raw DataCat output.