# Technical Studies Reference

### Highest High/Lowest Low Over N Bars

This study calculates and displays the Highest High and Lowest Low over a number of bars specified by the Length Input.

Let $$X^{(High)}$$ and $$X^{(Low)}$$ be random variables denoting the Input Data High and Input Data Low Inputs, respectively, and let $$X^{(High)}_t$$ and $$X^{(Low)}_t$$ be their respective values at Index $$t$$. Let the Input Length be denoted as $$n$$. Then we denote the Highest High and Lowest Low at Index $$t$$ for the given Inputs as $$\max_t\left(X^{(High)},n\right)$$ and $$\min_t\left(X^{(Low)},n\right)$$, respectively, and we calculate them for $$t \geq n - 1$$ as follows.

$$\max_t\left(X^{(High)},n\right) = \max\left\{X^{(High)}_{t - n + 1},...,X^{(High)}_t\right\}$$

$$\min_t\left(X^{(Low)},n\right) = \min\left\{X^{(Low)}_{t - n + 1},...,X^{(Low)}_t\right\}$$

This study is related to the Donchian Channel study. One notable difference between the two studies is that the Donchian Channel study is displaced forward by one bar by default. This study can also be displaced by one or more bars by using the Displacement setting on the Subgraphs tab in the Study Settings window for the study.

It is possible to calculate the difference between the Highest High and the Lowest Low study Subgraph values. To do this add the Study Subgraphs Difference study to the chart and set it to reference the Highest High and Lowest Low Subgraphs in the Highest High/Lowest Low Over N Bars study.

This study can also be based on another study to determine its highest high and lowest low over the specified number of bars by using the Based On setting. If you want the highest high and lowest low calculation to be based only on a single Study Subgraph of the study that this is based on, then set the Input Data High and Input Data Low to refer to the same Subgraph.