ta.macd() - Pine Script Function
ta.macd()
Section titled “ta.macd()”Overview
Section titled “Overview”MACD (moving average convergence/divergence). It is supposed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock’s price.
Syntax
Section titled “Syntax”ta.macd(source, fastlen, slowlen, siglen) → [series float, series float, series float]Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
Returns
Section titled “Returns”Tuple of three MACD series: MACD line, signal line and histogram line.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("MACD")[_, signalLine, _] = ta.macd(close, 12, 26, 9)plot(signalLine, color=color.orange)