talib.macd
Moving average convergence/divergence for source, from three lengths: fastlen, slowlen and siglen.
One call covers the whole study, including the signal line that siglen sizes.
talib.macd(series float source, series int fastlen, series int slowlen, series int siglen) → [series float, series float, series float]| Parameter | Type | Required | Description |
|---|---|---|---|
source | series float | yes | The series the study is built on. |
fastlen | series int | yes | The faster of the two averaging lengths. |
slowlen | series int | yes | The slower of the two averaging lengths. |
siglen | series int | yes | Length used for the signal line. |
Returns [series float, series float, series float] — Three series float values as a tuple, in the order line, signal, histogram.
indicator("MACD")
[line, signal, histogram] = talib.macd(close, 12, 26, 9)
plot(line, title = "Line")
plot(signal, title = "Signal")
plot(histogram, title = "Histogram")See also talib.alma · talib.atr · talib.barssince
Part of the function index.
Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.