# Technical Studies Reference

### Accumulation / Distribution Flow

This study calculates and displays the Accumulation/Distribution Flow which was created by Bill Williams. It also calculates and displayes an average of this quantity.

Let the Open, High, Low, and Close prices at Index $$t$$ be denoted, respectively, as $$O_t$$, $$H_t$$, $$L_t$$, and $$C_t$$. Let the Volume at Index $$t$$ be denoted as $$V_t$$, and let the Accumulation/Distribution Flow at Index $$t$$ be denoted as $$ADF_t$$.

The Accumulation/Distribution Flow is initialized to $$ADF_0 = 5000$$, and the values of $$ADF_t$$ are computed for all values of $$t > 0$$. However, the values of $$ADF_t$$ for $$t < n$$ are used only internally and not displayed as output. Only the values for $$t \geq n$$ are displayed.

If the Input Use Previous Close is set to No, then $$ADF_t$$ is computed for $$t > 0$$ as follows.

$$\displaystyle{ADF_t=\left\{ \begin{matrix} ADF_{t-1} & H_t - L_t = 0 \\ ADF_{t-1} + \frac{\left(C_t - O_t\right)}{\left(H_t - L_t\right)}V_t & H_t - L_t \neq 0 \end{matrix}\right .}$$

If the Input Use Previous Close is set to Yes, then $$AD_t$$ is computed for $$t > 0$$ as follows.

$$\displaystyle{ADF_t=\left\{ \begin{matrix} ADF_{t-1} & H_t - L_t = 0 \\ ADF_{t-1} + \frac{\left(C_t - C_{t-1}\right)}{\left(H_t - L_t\right)}V_t & H_t - L_t \neq 0 \end{matrix}\right .}$$

Note: In either case, the values of $$ADF_t$$ are only displayed for $$t \geq n$$. The values for $$0 \leq t < n - 1$$ are not displayed as output, but rather are stored internally for the purpose of computing the average, which we describe next.

The average of $$ADF_t$$ at chart bar $$t$$ is computed as a Simple Moving Average of Moving Average Length $$n$$. The value of this average at Index $$t$$ is denoted as $$\overline{ADF}_t(n)$$, and it is calculated for $$t \geq n$$ as follows.

$$\overline{ADF}_t(n) = MA_t(ADF,n)$$

In the above formula, $$ADF$$ is a random variable denoting the Accumulation/Distribution Flow.

#### Inputs

• Moving Average Length
• Use Previous Close: This Input determines whether the current Open or the prior Close price is to be used in the calculation of $$AD_t$$