---
id: "M:cAlgo.API.Internals.IIndicatorsAccessor.DonchianChannel(System.Int32)"
kind: "method"
type: "T:cAlgo.API.Internals.IIndicatorsAccessor"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/DonchianChannel/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# IIndicatorsAccessor.DonchianChannel

Member of [IIndicatorsAccessor](https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/index.md).

## DonchianChannel(int periods)

The Donchian channel is a volatility indicator forming a channel between the highest high and the lowest low of the chosen period.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
DonchianChannel DonchianChannel(int periods)
```

Python:

```python
api.Indicators.DonchianChannel(periods: int) -> DonchianChannel
```

### Parameters

- `periods` (`int`, Python `int`): Period of Calculation of the Donchian Channel

### Returns

`DonchianChannel` — Donchian Channel indicator instance

### Examples

C#:

```csharp
var donchianChannel = Indicators.DonchianChannel(20);
Print("Donchian top: {0}, middle: {1}, bottom: {2}", donchianChannel.Top.LastValue, donchianChannel.Middle.LastValue, donchianChannel.Bottom.LastValue);
```

Python:

```python
donchianChannel = api.Indicators.DonchianChannel(20)
api.Print(f"Donchian top: {donchianChannel.Top.LastValue}, middle: {donchianChannel.Middle.LastValue}, bottom: {donchianChannel.Bottom.LastValue}")
```

## DonchianChannel(Bars bars, int periods)

The Donchian channel is a volatility indicator forming a channel between the highest high and the lowest low of the chosen period.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
DonchianChannel DonchianChannel(Bars bars, int periods)
```

Python:

```python
api.Indicators.DonchianChannel(bars: Bars, periods: int) -> DonchianChannel
```

### Parameters

- `bars` (`Bars`, Python `Bars`): The Bars that will be used by indicator, you can pass another timeframe/symbol bars
- `periods` (`int`, Python `int`): Period of Calculation of the Dochian Channel

### Returns

`DonchianChannel` — Donchian Channel indicator instance

### Examples

C#:

```csharp
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyDonchian = Indicators.DonchianChannel(dailyBars, 20);
if (Symbol.Bid > dailyDonchian.Top.Last(1))
    Print("Bid broke above the 20 day high {0}", dailyDonchian.Top.Last(1));
```

Python:

```python
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyDonchian = api.Indicators.DonchianChannel(dailyBars, 20)
if api.Symbol.Bid > dailyDonchian.Top.Last(1):
    api.Print(f"Bid broke above the 20 day high {dailyDonchian.Top.Last(1)}")
```

