Thursday, September 09, 2010

Donchian Channel Lower [DCL]

Descripton
Summary:
This indicator script measures the lowest price of an underlying symbol in a specified number of periods.

Calculation:
The lowest low in a specified number of periods of the underlying symbol.

Developer:
Richard Donchian

Interpretation: 
1. Support: When the underlying symbol is moving downwards towards the indicator script, the underlying symbol is likely to reverse direction and move upwards.
2. Support Broken: When the underlying symbol breaks support by crossing below the indicator script, the underlying symbol is likely to continue moving downwards. 


Variables
TypeIdentifierDescription
Integer_symbolIndexUse for the underlying symbol on which to calculate the Donchian Channel Lower.
Integer_periodsUse for the number of periods to include in the result calculation.

OnInitialize
Function Parameters
TypeIdentifierDescription
SymbolsymbolIndexUse for the underlying symbol on which to calculate the Donchian Channel Lower.
IntegerperiodsUse for the number of periods to include in the Donchian Channel Lower calculation. [Default 10]
Implementation
	 ' Assign the parameters to script variables.
	_symbolIndex = symbolIndex
	_periods = periods

OnValues
Function Parameters
TypeIdentifierDescription
IntegerbarIndex
Integerlength
Implementation
	 ' Get the lowest prices of the current symbol, indexed by bar index. 
	Define low() As Number = BarLow(_symbolIndex, barIndex, length + _periods)
	Define min As Number
	 ' Use for the calculated Donchian Channel Lower values, indexed by bar index.
	Define results(length - 1) As Number
	 ' Calculate the Donchian Channel Lower values for the specified bar range.
	For i As Integer = length - 1 To 0 Step -1
		min = 1000000
		 ' Calculate the Donchian Channel Lower value for the current bar.
		For j As Integer = i + _periods - 1 To i Step -1
			If (low(j) < min) Then
				min = low(j)
			End If
		Next
		results(i) = min
	Next
	Return results

Copyright © 2010 IQBroker, LLC. All rights reserved.