Skip to content
Algo Trade Analytics Docs

array.variance() - Pine Script Function

The function returns the variance of an array’s elements.

array.variance(id, biased) → series float
NameTypeDescription
idarray<int/float>An array object.

The variance of the array’s elements.

  • If biased is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample.
//@version=6
indicator("array.variance example")
a = array.new_float(0)
for i = 0 to 9
array.push(a, close[i])
plot(array.variance(a))