# Technical Studies Reference

### Covariance

This study calculates and displays the Covariance of the data specified by the Input Array 1 and Input Array 2 Inputs.

Let $$X^{(1)}$$ and $$X^{(2)}$$ be random variables denoting Input Array 1 and Input Array 2, respectively, and let $$X^{(1)}_t$$ and $$X^{(2)}_t$$ be their respective values at Index $$t$$. Let the Input Length be denoted as $$n$$. Then we denote the Covariance at Index $$t$$ for the given Inputs as $$Cov_t\left(X^{(1)}, X^{(2)}, n\right)$$. We compute it in terms of Simple Moving Averages as follows.

$$\displaystyle{Cov_t\left(X^{(1)}, X^{(2)}, n\right) = SMA_t\left(X^{(1)}X^{(2)},n\right) - SMA_t\left(X^{(1)},n\right)SMA_t\left(X^{(2)},n\right)}$$

This is displayed for all $$t \geq n$$.

Note that if $$X^{(2)} = X^{(1)}$$, we have $$Cov_t\left(X^{(1)}, X^{(1)}, n\right) = Var_t\left(X^{(1)}, n\right)$$, which is the Variance of $$X^{(1)}$$.