MACDEXT
Summary
MACD variant where the fast, slow, and signal moving averages each use a user-selectable MA type. Outputs the MACD line, its signal line, and their difference (histogram). Hist sign change (MACD crossing its signal line) flags momentum shifts.
Formula
MACD = MA_fast(inReal) - MA_slow(inReal) Signal = MA_signal(MACD) Hist = MACD - Signal (each MA_* uses its own MA type and period)
Notes
- If the slow period is set smaller than the fast period, the fast and slow periods and their MA types are swapped so the slow moving average is always the longer one.
- A signal period of 1 disables signal-line smoothing for every signal MAType: the signal equals the MACD line and the histogram is zero.
Inputs
inReal— Source series
Outputs
outMACD— MACD line: fast MA minus slow MAoutMACDSignal— Signal line: MA of the MACD lineoutMACDHist— Histogram: MACD minus signal
Parameters
optInFastPeriod— Period of the fast MAoptInFastMAType— MA type for the fast MAoptInSlowPeriod— Period of the slow MAoptInSlowMAType— MA type for the slow MAoptInSignalPeriod— Period of the signal-line MAoptInSignalMAType— MA type for the signal line
Implementation
TA-Lib Definition: macdext.c · macdext.yaml
| Native | File |
|---|---|
| C | ta_MACDEXT.c |
| Rust | macdext.rs |
| Java | Core.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
MACD Extended, MACD with controllable MA type