Skip to content

Triple Exponential Moving Average

TEMA is a triple exponential moving average designed to reduce lag.

Method

tm.ta.tema(source, timeperiod)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-
timeperiodintNumber of periods for the indicator30

Outputs

OutputType
temanp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Triple Exponential Moving Average
tema = tm.ta.tema(data.close, timeperiod=30)
# Get the last value and print
last_value = tema.iloc[-1]
tm.log(f"Last value of Triple Exponential Moving Average is {last_value}")
# Plot the values of tema
tm.plot(tema, title="Triple Exponential Moving Average", overlay=False)