# Technical Studies Reference

### Up/Down Volume Difference Bars

The study calculates and displays OHLC-style bars for Up/Down Volume data.

The following variables are used in this study. The subscript $$t$$ indicates that we are specifying the values of these variables at Index $$t$$. Complete descriptions of these variables can be found in the documentation on sc.BaseDataIn[][] / sc.BaseData[][].

• $$V^{(U)}_t$$ = sc.BaseData[SC_UPVOL][sc.Index] = sc.UpTickVolume[sc.Index]
• $$V^{(D)}_t$$ = sc.BaseData[SC_DOWNVOL][sc.Index] = sc.DownTickVolume[sc.Index]
• $$\Delta V^{(UDH)}_t$$ = sc.BaseData[SC_UPDOWN_VOL_DIFF_HIGH][sc.Index]
• $$\Delta V^{(UDL)}_t$$ = sc.BaseData[SC_UPDOWN_VOL_DIFF_LOW][sc.Index]

The Open, High, Low, and Close at Index $$t$$ of the Up/Down Volume Difference Bars are denoted as $$O^{(UDV)}_t$$, $$H^{(UDV)}_t$$, $$L^{(UDV)}_t$$, and $$C^{(UDV)}_t$$, respectively. We compute them as follows.

$$\displaystyle{H^{(UDV)}_t = \Delta V^{(UDH)}_t}$$
$$\displaystyle{L^{(UDV)}_t = \Delta V^{(UDL)}_t}$$
$$\displaystyle{C^{(UDV)}_t = V^{(U)}_t - V^{(D)}_t}$$

Let $$N_t$$ denote the Number of Trades at Index $$t$$. To calculate $$O^{(UDV)}_t$$, we begin by calculating a raw value of the Open, denoted as $$O^{(UDV,raw)}_t$$

$$O^{(UDV,raw)}_t = \left\{ \begin{matrix} V^{(U)}_t - V^{(D)}_t & N_t = 1 \\ 0 & N_t \neq 1 \end{matrix}\right .$$

We then use this value to compute $$O^{(UDV)}_t$$ as follows.

$$O^{(UDV)}_t = \left\{ \begin{matrix} H^{(UDV)}_t & O^{(UDV,raw)}_t > H^{(UDV)}_t \\ O^{(UDV,raw)}_t & L^{(UDV)}_t \leq O^{(UDV,raw)}_t \geq H^{(UDV)}_t \\ L^{(UDV)}_t & O^{(UDV,raw)}_t < L^{(UDV)}_t \end{matrix}\right .$$

#### Inputs

• This study has no Inputs.