# 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_t(n)$$, $$BB_t(n)$$, and $$MB_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_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_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_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_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, $$DonchianMid_t(n)$$ is calculated as follows.

$$\displaystyle{MB_t(n) = \frac{TB_t(n) + BB_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.