Skip to content

Lowest and highest values over a specified period

MINMAX returns the lowest and highest values over a specified period.

Method

tm.ta.minmax(source, timeperiod)

Inputs

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

Outputs

OutputType
minnp.ndarray
maxnp.ndarray

Example usage

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