NinjaScript > Language Reference > Indicator Methods >

Donchian Channel

Print this Topic Previous pageReturn to chapter overviewNext page

Description

A moving average indicator developed by Richard Donchian. It plots the highest high and lowest low over the last period time intervals.

 

 

Syntax

DonchianChannel(int period)
DonchianChannel(IDataSeries input, int period)

 

Returns mean value (middle band)
DonchianChannel(int period)[int barsAgo]
DonchianChannel(IDataSeries input, int period)[int barsAgo]

 

Returns upper band value
DonchianChannel(int period).Upper[int barsAgo]
DonchianChannel(IDataSeries input, int period).Upper[int barsAgo]

 

Returns lower band value
DonchianChannel(int period).Lower[int barsAgo]
DonchianChannel(IDataSeries input, int period).Lower[int barsAgo]

 

 

Return Value

double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.

 

 

Parameters

input

Indicator source data (?)

period

Number of bars used in the calculation

 

 

Examples

// Prints the current upper value of a 20 period DonchianChannel using default price type
double value = DonchianChannel(20).Upper[0];
Print("The current DonchianChannel upper value is " + value.ToString());

 

// Prints the current lower value of a 20 period DonchianChannel using high price type
double value = DonchianChannel(High, 20).Lower[0];
Print("The current DonchianChannel lower value is " + value.ToString());

 

 

Source Code

You can view this indicator method source code by selecting the menu Tools > Edit NinjaScript > Indicator within the NinjaTrader Control Center window.