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
| Name | Type | Default |
|---|---|---|
| source | ArrayLike | |
| fast_period | int | 12 |
| slow_period | int | 26 |
| signal_period | int | 9 |
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) -> NoneThe gap between a fast and a slow EMA, with a signal line and histogram.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| fast_period | int | 12 | 1 to 5000 |
| slow_period | int | 26 | 1 to 5000 |
| signal_period | int | 9 | 1 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