Donchian Channel
Previous Topic  Next Topic 

Definition

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 inputData, int period)

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

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

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


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


Parameters

period

The number of bars to include in the calculation

inputData

Indicator source data (?)


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 open up the indicator source code via the NinjaScript Editor.