CovarEasy (Function)
The CovarEasy function calculates the covariance of a single dependent variable and length.
The covariance measures their tendency to vary together. Where the variance is the average of the squared deviation of a data set from its mean, the covariance is the average of the products of the deviations of the data set values from their means.
Syntax
CovarEasy(Dep,Length)
Returns (Double)
A numeric value for the current bar.
Parameters
|
Name |
Type |
Description |
|
Dep |
Numeric |
Sets the dependent value used to calculate the covariance. |
|
Length |
Numeric |
Sets the number of bars to consider in the covariance. |
Remarks
The input parameter Dep can be a bar or multi-data value such as Close, High, Low, Open, or Volume. It can also be any mathematical calculation such as (High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.
The value for the Length input parameter should always be a whole number greater than 0.
Example
Assigns to Value1 the covariance the Close over the last 20 bars, then plots Value1:
Value1 = CovarEasy(Close, 20);
Plot1(Value1, "CovarEasy");