# Technical Studies Reference

### Inertia 2

This study calculates and displays the Inertia 2 study. The step-by-step calculation method is explained below.

The components of the Relative Vigor Index (RVI) are calculated as follows. We let $$C_i$$ be the closing price at time index $$i$$. We also let $$r$$ be the RVI Length and let $$s$$ be the Standard Deviation Length, both of which are inputs.

Standard Deviation:

The $$i^{th}$$ moving average of the closing prices taken $$s$$ at a time is given as follows.

$$\overline{C}_i=\frac{1}{s}\sum_{k=1}^s{C_{k+i-1}}$$

This is the average of the sequence of $$C$$'s starting at $$C_i$$ and ending at $$C_{s+i-1}$$. This will enter into our formula for standard deviation, which is given as follows.

$$StdDeviation_i=\sqrt{\frac{1}{n}\sum_{k=1}^s{\left(C_{k+i-1}-\overline{C}_i\right)^2}}$$

This is the standard deviation of the sequence of $$C$$'s starting at $$C_i$$ and ending at $$C_{s+i-1}$$.

RVI Up:

$$RVIUp_i=\left\{ \begin{matrix} StdDeviation_i & C_i > C_{i-1} \\ 0 & C_i \leq C_{i-1} \end{matrix}\right .$$

According to this formula, $$RVIUp_i$$ is nonzero if and only if the closing price is increasing.

RVI Down:

$$RVIDown_i=\left\{ \begin{matrix} 0 & C_i > C_{i-1} \\ StdDeviation_i & C_i \leq C_{i-1} \end{matrix}\right .$$

According to this formula, $$RVIDown_i$$ is nonzero if and only if the closing price is nonincreasing.

RVI Up Average:

$$RVIUpAvg_i=\left\{ \begin{matrix} \frac{(r-1)RVIUpAvg_{i-1}+RVIUp_i}{r} & r \neq 0 \\ 0 & r=0 \end{matrix}\right .$$

This moving average is a recursion relation with $$RVIUpAvg_0=0$$.

RVIDownAvg:

$$RVIDownAvg_i=\left\{ \begin{matrix} \frac{(r-1)RVIDownAvg_{i-1}+RVIDown_i}{r} & r \neq 0 \\ 0 & r=0 \end{matrix}\right .$$

This moving average is a recursion relation with $$RVIDownAvg_0=0$$.

RVI: From these we calculate the RVI as follows.

$$RVI_i=\left\{ \begin{matrix} \frac{RVIUpAvg_i}{RVIUpAvg_i+RVIDownAvg_i} & RVIUpAvg_i+RVIDownAvg_i \neq 0 \\ 0 & RVIUpAvg_i+RVIDownAvg_i=0 \end{matrix} \right .$$

Inertia Calculation:

The inertia of the RVI is precisely the Linear Regression Indicator (LRI) of the RVI. The LRI is described in detail in Moving Linear Regression / Moving Average - Least Squares. We let $$l$$ be the Linear Regression Length, which is an input. The regression statistics are calculated for each $$i$$ where the data points are taken $$l$$ at a time. Explicit formulas are given below.

$$b_i=\frac{l \cdot \sum_{k=1}^l{(k+i-1)RVI_{k+i-1}}-\sum_{k=1}^l{(k+i-1)}\cdot \sum_{k=1}^l{RVI_{k+i-1}}}{l \cdot \sum_{k=1}^l{(k+i-1)^2}-\left(\sum_{k=1}^l{(k+i-1)}\right)^2}$$ $$a_i=\frac{\sum_{k=1}^l{RVI_{k+i-1}}-b_i \cdot \sum_{k=1}^l{(k+i-1)}}{l}$$ $$LRI_i=a_i+lb_i$$