math.avg
Take the midpoint of two series, such as the middle of the high and low.
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.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
a | Series | number | - | - | First value. |
b | Series | number | - | - | Second value. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
- None.
- Missing values
- na in either argument gives na.
Example
math.avg(high, low)plot(math.avg(high, low), "Midpoint")