array.variance() - Pine Script Function
array.variance()
Section titled “array.variance()”Overview
Section titled “Overview”The function returns the variance of an array’s elements.
Syntax
Section titled “Syntax”array.variance(id, biased) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | array<int/float> | An array object. |
Returns
Section titled “Returns”The variance of the array’s elements.
Remarks
Section titled “Remarks”- If biased is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.variance example")a = array.new_float(0)for i = 0 to 9array.push(a, close[i])plot(array.variance(a))