# Technical Studies Reference

This study calulates and displays a Moving Average of the Bid Ask Volume Ratio at each chart bar.

Depending upon the Data or Trading service you are using, you may not receive historical Ask and Bid Volumes when historical data is downloaded from the service. Not all services will provide this.

Let the Ask Volume and Bid Volume at Index $$t$$ be denoted as $$V^{(ask)}_t$$ and $$V^{(bid)}_t$$, respectively. We denote Volume Ratio at index $$t$$ as $$VR_t$$, and the formula used to compute it depends on the setting of the Input Difference Calculation Method.

If the Input Difference Calculation Method is set to Ask Volume - Bid Volume, then we compute $$VR_t$$ as follows.

$$\displaystyle{VR_t = \left\{ \begin{matrix} 100 \cdot \frac{V^{(ask)}_t - V^{(bid)}_t}{V^{(ask)}_t + V^{(bid)}_t} & V^{(ask)}_t + V^{(bid)}_t > 0 \\ 0 & V^{(ask)}_t + V^{(bid)}_t \leq 0 \end{matrix}\right .}$$

If the Input Difference Calculation Method is set to Bid Volume - Ask Volume, then we compute $$VR_t$$ as follows.

$$\displaystyle{VR_t = \left\{ \begin{matrix} 100 \cdot \frac{V^{(bid)}_t - V^{(ask)}_t}{V^{(ask)}_t + V^{(bid)}_t} & V^{(ask)}_t + V^{(bid)}_t > 0 \\ 0 & V^{(ask)}_t + V^{(bid)}_t \leq 0 \end{matrix}\right .}$$

Let the Input Length be denoted as $$n$$, and let the Volume Ratio Average at Index $$t$$ for this Length be denoted as $$\overline{VR}_t(n)$$. This is the function that is displayed by the study Bid Ask Volume Ratio. We compute $$\overline{VR}_t(n)$$ for $$t \geq 0$$ in terms of an Exponential Moving Average as follows.

For $$t = 0$$: $$\overline{VR}_t = VR_0$$

For $$0 < t < n$$: $$\overline{VR}_t = \displaystyle{\left\{\begin{matrix} \left(\frac{2}{t + 2}\right)VR_t + \left(1 - \frac{2}{t + 2}\right)VR_{t - 1} & \overline{VR}_{t - 1} = 0 \\ \left(\frac{2}{t + 2}\right)VR_t + \left(1 - \frac{2}{t + 2}\right)\overline{VR}_{t - 1}(n) & \overline{VR}_{t - 1} \neq 0 \end{matrix}\right .}$$

For $$t \geq n$$: $$\overline{VR}_t = EMA_t(VR,n)$$

In the above formula, $$VR$$ is a random variable denoting the Volume Ratio.

Note: Depending on the setting of the Input Moving Average Type, the Exponential Moving Average in the calculation of $$\overline{VR}_t(n)$$ for $$t > 0$$ could be replaced with a Linear Regression Moving Average, a Simple Moving Average, a Weighted Moving Average, a Wilders Moving Average, a Simple Moving Average - Skip Zeros, or a Smoothed Moving Average.