Login Page - Create Account

# Volatility Trend Indicator

This study calculates and displays a Volatility Trend Indicator of the data specified by the Input Data Input.

Let $$X$$ be a random variable denoting the Dynamic Period Input Data Input. Let the Average True Length, ATR Multiplier, and Max. Dynamic Period for Trend Calculation Inputs be denoted as $$n$$, $$\mu$$, and $$DPL_{\max}$$, respectively.

We denote the Volatility Trend Indicator (VTI) at Index $$t$$ for the given Inputs as $$VTI_t(X,n,\mu,DPL_{\max})$$. We describe the detailed calculation of the VTI later, but we note here that it is initialized to zero. We denote the Direction of $$X$$ at Index $$t$$ as $$Dir_t(X,n,\mu,DPL_{\max})$$, and we compute it for $$t \geq 0$$ as follows.

$$Dir_t(X,n,\mu,DPL_{\max}) =\left\{ \begin{matrix} 1 & X_t > VTI_{t - 1}(X,n,\mu,DPL_{\max}) \\ -1 & X_t \leq VTI_{t - 1}(X,n,\mu,DPL_{\max}) \end{matrix}\right .$$

The Direction takes on the value $$1$$ in the case of an Uptrend, and it takes on the value $$-1$$ in the case of a Downtrend.

We denote the Dynamic Period Length (DPL) at Index $$t$$ for the given Inputs as $$DPL_t(X,n,\mu,DPL_{\max})$$. We will describe the calculation of the DPL shortly, but we note here that it is initialized to zero. We calculate the DPL using three intermediate Periods, called Period 1, Period 2, and Period 3. We denote these as $$\pi^{(1)}_t(X,n,\mu,DPL_{\max})$$, $$\pi^{(2)}_t(X,n,\mu,DPL_{\max})$$, and $$\pi^{(3)}_t(X,n,\mu,DPL_{\max})$$, respectively, and we compute them for $$t \geq 0$$ as follows.

$$\pi^{(1)}_t(X,n,\mu,DPL_{\max}) = DPL_{t - 1}(X,n,\mu,DPL_{\max})$$

$$\pi^{(2)}_t(X,n,\mu,DPL_{\max}) = \left\{ \begin{matrix} \pi^{(1)}_t(X,n,\mu,DPL_{\max}) & & Dir_{t - 1}(X,n,\mu,DPL_{\max}) = Dir_t(X,n,\mu,DPL_{\max}) \\ 0 & & Dir_{t - 1}(X,n,\mu,DPL_{\max}) \neq Dir_t(X,n,\mu,DPL_{\max}) \end{matrix}\right .$$

This function resets the Period to $$0$$ in the event of a change in Trend.

$$\pi^{(3)}_t(X,n,\mu,DPL_{\max}) = \left\{ \begin{matrix} \pi^{(2)}_t(X,n,\mu,DPL_{\max}) + 1 & & \pi^{(2)}_t(X,n,\mu,DPL_{\max}) < DPL_{\max} \\ \pi^{(2)}_t(X,n,\mu,DPL_{\max}) & & \pi^{(2)}_t(X,n,\mu,DPL_{\max}) \geq DPL_{\max} \end{matrix}\right .$$

We now compute $$DPL_t(X,n,\mu,DPL_{\max})$$ for $$t \leq n - 1$$ as follows.

$$DPL_t(X,n,\mu,DPL_{\max}) = \pi^{(3)}_t(X,n,\mu,DPL_{\max})$$

The graph of $$DPL_t(X,n,\mu,DPL_{\max})$$ can be displayed with Analysis >> Studies >> Volatility Trend Indicator >> Settings >> Subgraphs >> Dynamic Period Length (SG5) >> [select Draw Style] >> OK >> OK.

Finally, we compute $$VTI_t(X,n,\mu,DPL_{\max})$$ in terms of the Average True Range for $$t \geq n - 1$$ as follows.

$$VTI_t(X,n,\mu,DPL_{\max}) = \left\{ \begin{matrix} \max\{X_{t - \pi^{(3)}_t(X,n,\mu,DPL_{\max}) + 1},...,X_t\} - \mu\cdot \overline{TR}_t(n) & & Dir_t(X,n,\mu,DPL_{\max}) = 1 \\ \min \{X_{t - \pi^{(3)}_t(X,n,\mu,DPL_{\max}) + 1},...,X_t\} - \mu\cdot \overline{TR}_t(n) & & Dir_t(X,n,\mu,DPL_{\max}) = -1 \end{matrix}\right .$$

The color of the graph of $$VTI_t(X,n,\mu,DPL_{\max})$$ changes depending on the trend. The default values for an Uptrend and a Downtrend are green and red, respectively.

Note: In the above formula, the quantities $$\max\{X_{t - \pi^{(3)}_t(X,n,\mu,DPL_{\max}) + 1},...,X_t\}$$ and $$\min\{X_{t - \pi^{(3)}_t(X,n,\mu,DPL_{\max}) + 1},...,X_t\}$$ are, respectively, the high and low values of $$X$$ over a Period of length $$\pi^{(3)}_t(X,n,\mu,DPL_{\max})$$ terminating at Index $$t$$.

Note: By default, $$\overline{TR}_t(n)$$ is calculated using a Weighted Moving Average. Depending on the setting of the Input ATR Moving Average Type, the Weighted Moving Average in the calculation could be replaced with an Exponential Moving Average, a Linear Regression Moving Average, a Simple Moving Average, a Wilders Moving Average, a Simple Moving Average - Skip Zeros, or a Smoothed Moving Average.

#### Inputs

• Average True Range Length: This is the length of the Average True Range calculation used in the study.
• Average True Range Moving Average Type: This is the type of moving average used in the Average True Range calculation used in the study.
• ATR Multiplier: This is the value multiplied by the Average True Range result used in the study calculations.
• Max. Dynamic Period for Trend Calculation: This Input specifies the maximum length in bars when determining the highest and lowest prices beginning at the current calculation index and going back by this calculated period length.
• Dynamic Period Input Data: This Input specifies the particular element of a bar to use when determining the highest and lowest prices over the calculated period length. By default it is set to Last. This is a standard Input Data Input.