Donchian Channel

Description

The Donchian channel can also be called the “4-week-rule”; this is how it works: when the current price reaches a peak above the high of the past 4 weeks, a new long position is opened. If a short position is open simultaneously, it is closed. This works vice versa with shorts. The Donchian channel trading system is a purely trend-following system based on the concept “buy when it is strong, sell when it is weak”. The famous “Turtles” also employed this breakout system. This indicator displays the highs and lows of the last n days as lines above and below the price development. 20 days represent 4 weeks.

Further information

VTAD: http://vtadwiki.vtad.de/index.php/Donchian_Channel

Usage

DonchianChannel(int period)
DonchianChannel(IDataSeries inSeries, int period)

//Upper band
DonchianChannel(int period).Upper[int barsAgo]
DonchianChannel(IDataSeries inSeries, int period).Upper[int barsAgo]

//Middle band
DonchianChannel(int period)[int barsAgo]
DonchianChannel(IDataSeries inSeries, int period)[int barsAgo]

//Lower band
DonchianChannel(int period).Lower[int barsAgo]
DonchianChannel(IDataSeries inSeries, int period).Lower[int barsAgo]

Return value

double

When using this method with an index (e.g. DonchianChannel(14)[int barsAgo] ), the value of the indicator will be issued for the referenced bar.

Parameters

inSeries Input data series for the indicator

period Number of bars included in the calculations

Visualization

Example

//Output for the values of the Donchian Channel
Print("The upper band is at: " + DonchianChannel(14).Upper[0]);
Print("The middle band is at: " + DonchianChannel(14)[0]);
Print("The lower band is at: " + DonchianChannel(14).Lower[0]);

Last updated