# Donchian channel

`donchian`

Highest high and lowest low of the last N bars, with their midpoint.

## Inputs

| Name | Type | Default | Range |
| --- | --- | --- | --- |
| period | int | 20 | 1 to 5000 |

## Outputs

| Name | Kind |
| --- | --- |
| upper | value |
| lower | value |
| middle | value |

Warm-up: period - 1 bars (19 at the defaults).

Repaints: No.

## Formula

upper = the highest high of the last period bars

lower = the lowest low of the last period bars

middle = (upper + lower) / 2
