macd

forge.tafunctionSince Forge API 1
Functionpython
forge.ta.macd(source: ArrayLike,fast_period: int = 12,slow_period: int = 26,signal_period: int = 9) -> dict[str, np.ndarray]

MACD: the fast EMA minus the slow EMA, its signal line and the gap between them.

Parameters

NameTypeDefault
sourceArrayLike
fast_periodint12
slow_periodint26
signal_periodint9

Indicator: MACD

Both EMAs are seeded on the first value (MetaTrader 5). The signal is the simple average of the MACD line, as MetaTrader 5 computes it. The histogram is the MACD line minus the signal.

Classpython
forge.ta.MACD(**inputs: Any) -> None

The gap between a fast and a slow EMA, with a signal line and histogram.

Inputs

NameTypeDefaultRange
sourcesourceclose
fast_periodint121 to 5000
slow_periodint261 to 5000
signal_periodint91 to 5000

MACD = EMA(source, fast_period) - EMA(source, slow_period), both seeded on the first value

signal = the simple average of MACD over signal_period, as MetaTrader 5 computes it

histogram = MACD - signal