# Technical Studies Reference

### On Balance Open Interest - Short Term

This study calculates and displays the On Balance Open Interest over a specific length of bars.

Let $$C_t$$ be the value of the Close Price at Index $$t$$. We denote the Signed Open Interest at Index $$t$$ as $$OI^{(\pm)}_t$$, and we initialize this quantity to zero (that is, $$OI^{(\pm)}_0 = 0$$). We compute the Signed Open Interest for $$t > 0$$ in terms of the Open Interest as follows.

$$\displaystyle{OI^{(\pm)}_t = \left\{ \begin{matrix} OI_t & C_t > C_{t - 1} \\ 0 & C_t = C_{t - 1} \\ -OI_t & C_t < C_{t - 1} \end{matrix}\right .}$$

Let the Length Input be denoted as $$n$$. We denote the On Balance Open Interest - Short Term for this Input at Index $$t$$ as $$OI^{(OB)}_t(n)$$, and we describe the calculation of this quantity below.

For $$0 \leq t < n$$, $$OI^{(OB)}_t(n)$$ is calculated internally as follows. These values are not displayed as output.

$$\displaystyle{OI^{(OB)}_t(n) = \left\{ \begin{matrix} 0 & t = 0 \\ OI^{(OB)}_{t - 1}(n) + OI^{(\pm)}_t & 0 < t < n \end{matrix}\right .}$$

The above formula is equivalent to $$OI^{(OB)}_t(n) = OI^{(OB)}_t$$, where $$OI^{(OB)}_t$$ is the On Balance Open Interest. That is, for $$0 \leq t < n$$, the On Balance Open Interest - Short Term is equivalent to the ordinary On Balance Open Interest.

For $$t \geq n$$, $$OI^{(OB)}_t(n)$$ is calculated as follows. These values are displayed as output.

$$OI^{(OB)}_t(n) = OI^{(OB)}_{t - 1}(n) + OI^{(\pm)}_t - OI^{(\pm)}_{t - n}$$