Lipi Reference Lipi

Functions

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.

Syntax · 1 of 4

                math.avg(const float number0, number1, ...) → const float
              

Arguments

number0, number1, ... required const float

Return Type

const float

Syntax · 2 of 4

                math.avg(input float number0, number1, ...) → input float
              

Arguments

number0, number1, ... required input float

Return Type

input float

Syntax · 3 of 4

                math.avg(simple float number0, number1, ...) → simple float
              

Arguments

number0, number1, ... required simple float

Return Type

simple float

Syntax · 4 of 4

                math.avg(series float number0, number1, ...) → series float
              

Arguments

number0, number1, ... required series float

Return Type

series float

Example


          indicator("Math Avg Example", overlay=true)
val1 = close
val2 = open
avgValue = math.avg(val1, val2)
plot(avgValue, color=color.blue, title="Average")