# Technical Studies Reference

### Donchian Channel

This study calculates and displays moving High, Low, and Middle Bands of the Price data over a number of bars specified by the Length Input. By default this study uses a displacement of +1 which forward-shifts the study by one bar.

Let $$H$$, $$L$$, and $$C$$ be random variables denoting the High, Low, and Close Prices, respectively, and let their respective values at Index $$t$$ be $$H_t$$, $$L_t$$, and $$C_t$$. Let the Length Input be denoted as $$n$$.Then denote the High, Low, and Middle Bands of the Donchian Channel for the given Input at Index $$t$$ as $$TB^{(D)}_t(n)$$, $$BB^{(D)}_t(n)$$, and $$MB^{(D)}_t(n)$$, respectively. We calculate these for $$t \geq 1$$, and the method of calculation depends on the setting of the Use Close instead of High and Low Input. We describe the calculations in detail below.

If Use Close instead of High and Low is set to No:

$$\displaystyle{TB^{(D)}_t(n) = \left\{\begin{matrix} \max\{H_0,...,H_{t - 1}\} & t < n \\ \max\{H_{t - n},...,H_{t - 1}\} & t \geq n \end{matrix}\right .}$$

$$\displaystyle{BB^{(D)}_t(n) = \left\{\begin{matrix} \min\{L_0,...,L_{t - 1}\} & t < n \\ \min\{L_{t - n},...,L_{t - 1}\} & t \geq n \end{matrix}\right .}$$

If Use Close instead of High and Low is set to Yes:

$$\displaystyle{TB^{(D)}_t(n) = \left\{\begin{matrix} \max\{C_0,...,C_{t - 1}\} & t < n \\ \max\{C_{t - n},...,C_{t - 1}\} & t \geq n \end{matrix}\right .}$$

$$\displaystyle{BB^{(D)}_t(n) = \left\{\begin{matrix} \min\{C_0,...,C_{t - 1}\} & t < n \\ \min\{C_{t - n},...,C_{t - 1}\} & t \geq n \end{matrix}\right .}$$

Regardless of the setting of the Use Close instead of High and Low Input, $$MB^{(D)}_t(n)$$ is calculated as follows.

$$\displaystyle{MB^{(D)}_t(n) = \frac{TB^{(D)}_t(n) + BB^{(D)}_t(n)}{2}}$$

#### Inputs

• Length
• Use Close instead of High and Low: Determines whether the High and Low Prices or the Close Price is used in the calculations.