Docs

math.avg

Take the midpoint of two series, such as the middle of the high and low.

itm
math.avg(a, b)

The arithmetic mean of two values: (a + b) / 2. Every call has an exact arity, so this one takes two and nests. math.avg(math.avg(a, b), c) is not the mean of three, so write (a + b + c) / 3 when that is what you want.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
aSeriesnumber--First value.
bSeriesnumber--Second value.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
None.
Missing values
na in either argument gives na.

Example

itm
math.avg(high, low)
itm
plot(math.avg(high, low), "Midpoint")