Skip to content

Moving Average Convergence/Divergence Fix

MACDFIX is a fixed version of MACD with specific parameters.

Method

tm.ta.macdfix(source, signalperiod)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-
signalperiodintSignal period for the indicator9

Outputs

OutputType
macdnp.ndarray
macdsignalnp.ndarray
macdhistnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Moving Average Convergence/Divergence Fix 12/26
macd, macdsignal, macdhist = tm.ta.macdfix(data.close, signalperiod=9)
# Get the last value and print
last_value = macd.iloc[-1]
tm.log(f"Last value of Moving Average Convergence/Divergence Fix 12/26 is {last_value}")
# Plot the values of macd
tm.plot(macd, title="Moving Average Convergence/Divergence Fix 12/26", overlay=False)