Skip to content

MidPoint over period

Midpoint represents the average value over a specified period.

Method

tm.ta.midpoint(source, timeperiod)

Inputs

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

Outputs

OutputType
midpointnp.ndarray

Example usage

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