math.max

The largest of the numbers you pass. It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

math.max(const float number0, number1, ...) → const float
math.max(const int number0, number1, ...) → const int
math.max(input float number0, number1, ...) → input float
math.max(input int number0, number1, ...) → input int
math.max(series float number0, number1, ...) → series float
math.max(series int number0, number1, ...) → series int
math.max(simple float number0, number1, ...) → simple float
math.max(simple int number0, number1, ...) → simple int
ParameterTypeRequiredDescription
number0, number1, ...const floatyesThe numbers to compare, passed as a list. There is an int form and a float form.

Returns const float or const int or input float or input int or series float or series int or simple float or simple int — The largest argument. Int arguments give an int and float arguments give a float, in the arguments’ form.

indicator("Larger of the open and the close")
plot(math.max(close, open))

See also math.abs · math.acos · math.asin

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade