math.avg
The arithmetic mean of the numbers you pass: their sum divided by how many there are. It averages the arguments in the one call. It does not average a value across bars, and it takes no length argument.
math.avg(const float number0, number1, ...) → const floatmath.avg(input float number0, number1, ...) → input floatmath.avg(series float number0, number1, ...) → series floatmath.avg(simple float number0, number1, ...) → simple float| Parameter | Type | Required | Description |
|---|---|---|---|
number0, number1, ... | const float | yes | The numbers to average, passed as a list. Ints are accepted, and the contract types the list as float. |
Returns const float or input float or series float or simple float — The mean, as a float in the arguments’ form. There is no int form of this function, so int arguments still give a float.
indicator("Mean of the high and the low")
plot(math.avg(high, low))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.