Skip to content

Highest value over a specified period

MAX calculates the highest value in a given period.

Method

tm.ta.max(source, timeperiod)

Inputs

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

Outputs

OutputType
maxnp.ndarray

Example usage

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