Skip to content

IIndicatorsAccessor.DonchianChannel

method · IIndicatorsAccessor · cAlgo.API.Internals

DesktopCLICloud

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

Overloads

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.

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

Parameters

Name C# type Python type Description
periods int int Period of Calculation of the Donchian Channel

Returns DonchianChannel — Donchian Channel indicator instance

Examples

var donchianChannel = Indicators.DonchianChannel(20);
Print("Donchian top: {0}, middle: {1}, bottom: {2}", donchianChannel.Top.LastValue, donchianChannel.Middle.LastValue, donchianChannel.Bottom.LastValue);
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.

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

Parameters

Name C# type Python type Description
bars Bars Bars The Bars that will be used by indicator, you can pass another timeframe/symbol bars
periods int int Period of Calculation of the Dochian Channel

Returns DonchianChannel — Donchian Channel indicator instance

Examples

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));
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)}")