Volume Positive Negative Indicator

This study calculates and displays a Volume Positive Negative Indicator of the data specified by the Input Data Input.

Let $$X_t$$ and $$V_t$$ be the values of the Input Data and Volume, respectively, at Index $$t$$. Let the Inputs ATR Coefficient, VPN Length, VPN Smoothing Length, and Avg VPN Length be denoted as $$k$$, $$n_{VPN}$$, $$n_S$$, and $$n_{\overline{VPN}}$$, respectively.

We denote the Volume Up and Volume Down at Index $$t$$ as $$V^{(+)}_t(k,n_{VPN})$$ and $$V^{(-)}_t(k,n_{VPN})$$, respectively, and we compute in terms of the Average True Range them as follows.

$$\displaystyle{V^{(+)}_t(k,n_{VPN}) = \left\{ \begin{matrix} V_t & X_t \geq X_{t - 1} + k \cdot ATR_t(n_{VPN}) \\ 0 & X_t < X_{t - 1} + k \cdot ATR_t(n_{VPN}) \end{matrix}\right .}$$

$$\displaystyle{V^{(-)}_t(k,n_{VPN}) = \left\{ \begin{matrix} V_t & X_t \leq X_{t - 1} - k \cdot ATR_t(n_{VPN}) \\ V_t & X_t < X_{t - 1} - k \cdot ATR_t(n_{VPN}) \end{matrix}\right .}$$

Note: In the above formulas, $$ATR_t(n_{VPN})$$ is computed using the Welles Wilder Moving Average by default. This average type can be changed via the ATR Avg Type Input.

Next we compute the following Volume Ratio, denoted as $$VR_t(n_{VPN},n_S)$$.

$$\displaystyle{VR_t(k,n_{VPN}) = \frac{\sum_{i = t - n_{VPN} + 1}^t (V^{(+)}_t(k,n_{VPN}) - V^{(-)}_t(k,n_{VPN}))}{\sum_{i = t - n_{VPN} + 1}^t V_t}}$$

If the sum in the denominator of the Volume Ratio is zero, then $$VR_t(k,n_{VPN}) = 0$$.

We denote the Volume Positive Negative Indicator at Index $$t$$ as $$VPN_t(k,n_{VPN},n_S)$$, and we compute it by smoothing the Volume Ratio with an Exponential Moving Average as follows.

$$VPN_t(k,n_{VPN},n_S) = EMA_t(VR_t(k,n_{VPN}),n_S)$$

Note: In the above formula, the moving average type can be changed via the VPN Smoothing Avg Type Input.

A second Subgraph that is displayed is the Average VPN, denoted as $$\overline{VPN}(k,n_{VPN},n_S,n_{\overline{VPN}})$$. We compute it using a Simple Moving Average as follows.

$$\overline{VPN}(k,n_{VPN},n_S,n_{\overline{VPN}}) = SMA_t(VPN_t(k,n_{VPN},n_S),n_{\overline{VPN}})$$

A third Subgraph that is displayed is a horizontal line at the level of the Critical Value Input.

Finally, a fourth Subgraph that is displayed is a Center Line.