math.sum

The sum of the numbers you pass. It adds the arguments in the one call. There is no length argument anywhere in its signature, so it is not a running total over bars.

math.sum(const float number0, number1, ...) → const float
math.sum(const int number0, number1, ...) → const int
math.sum(input float number0, number1, ...) → input float
math.sum(input int number0, number1, ...) → input int
math.sum(series float number0, number1, ...) → series float
math.sum(series int number0, number1, ...) → series int
math.sum(simple float number0, number1, ...) → simple float
math.sum(simple int number0, number1, ...) → simple int
ParameterTypeRequiredDescription
number0, number1, ...const floatyesThe numbers to add, 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 total. Int arguments give an int and float arguments give a float, in the arguments’ form.

indicator("High plus low plus close")
plot(math.sum(high, low, close))

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