array.covariance() - Pine Script Function
array.covariance()
Section titled “array.covariance()”Overview
Section titled “Overview”The function returns the covariance of two arrays.
Syntax
Section titled “Syntax”array.covariance(id1, id2, biased) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id1 | array<int/float> | An array object. |
Returns
Section titled “Returns”The covariance of two arrays.
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. Returns na if both arrays are empty.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.covariance example")a = array.new_float(0)b = array.new_float(0)for i = 0 to 9array.push(a, close[i]) array.push(b, open[i])plot(array.covariance(a, b))