Lipi Reference
Lipi

Functions

array.covariance()

Returns the covariance of two arrays of the same size. `biased` chooses the estimate: true (the default) divides by the number of elements, false by one less.

Syntax

                array.covariance(series array id1, series array id2, series bool biased) → series float
              

Arguments

id1 required series array
id2 required series array
biased series bool

Return Type

series float

Example


          //@lipi=2
indicator("array.covariance Example", overlay=false)
static array<float> a = array.new_float(20, close)
static array<float> b = array.new_float(20, volume)
array.shift(a)
array.push(a, close)
array.shift(b)
array.push(b, volume)
plot(array.covariance(a, b), title="Close/Volume Covariance", color=color.blue)