MACD

Calculates the Moving Average Convergence Divergence indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
applyToSeries<Number>
close
-
fastPeriodNumber12-
slowPeriodNumber26-

Returns: Series<Number>

MACD is a built-in function - you can use it directly. Below is an example implementation:

1 function MACD(applyTo = close, fastPeriod = 12, slowPeriod = 26):
2 EMA(applyTo, fastPeriod) - EMA(applyTo, slowPeriod)