Saturday, September 04, 2010

Bullish Morning Doji Star [UMDS]

Descripton
Rules:
1. The first candlestick is a long red candlestick.
2. The second candlestick is a very short red candlestick with almost no body which gaps below the first candlestick.
3. The third bar is a long green bar which closes in the body of the second bar.

Pattern Type:
Bullish Reversal.


Variables
TypeIdentifierDescription
Integer_symbolIndexUse for the underlying symbol index on which to calculate the Bullish Morning Doji Star.
Number_minCandleSizeUse for the minimum percentage change (open to close) that a candlestick must change in order to be considered a long candlestick.
Number_maxDojiBodySizeUse for the maximum percentage change a Doji can have between its opening and closing price.
Number_maxDojiShadowSizesUse for the maximum percentage change a Doji can have between its highest and lowest price.

OnInitialize
Function Parameters
TypeIdentifierDescription
SymbolsymbolIndexUse for the underlying symbol index on which to calculate the Bullish Morning Doji Star.
NumberminCandleSizeUse for the minimum percentage change (open to close) that a candlestick must change in order to be considered a long candlestick. [Default 1]
NumbermaxDojiBodySizeUse for the maximum percentage change a Doji can have between its opening and closing price. [Default 0.2]
NumbermaxDojiShadowSizesUse for the maximum percentage change a Doji can have between its highest and lowest price. [Default 1]
Implementation
	 ' Assign the parameters to script variables.
	_symbolIndex = symbolIndex
	_minCandleSize = minCandleSize
	_maxDojiBodySize = maxDojiBodySize
	_maxDojiShadowSizes = maxDojiShadowSizes

OnPattern
Function Parameters
TypeIdentifierDescription
IntegerbarIndex
Implementation
	 ' Get the opening prices of the symbol, indexed by bar index. 
	Define open() As Number = BarOpen(_symbolIndex, barIndex, 3)
	 ' Get the highest prices of the symbol, indexed by bar index. 
	Define high() As Number = BarHigh(_symbolIndex, barIndex, 3)
	 ' Get the lowest prices of the symbol, indexed by bar index. 
	Define low() As Number = BarLow(_symbolIndex, barIndex, 3)
	 ' Get the closing prices of the symbol, indexed by bar index. 
	Define close() As Number = BarClose(_symbolIndex, barIndex, 3)
	 ' Check whether the first candlestick matches.
	If (open(2) > close(2) And _
	    -100 * (close(2) - open(2)) / open(2) >  _minCandleSize) Then
		 ' Check whether the second candlestick matches.
		If (high(1) < low(2) And _
			MathAbs(100 * (open(1) - close(1)) / open(1)) < _maxDojiBodySize And _
			MathAbs(100 * (high(1) - low(1)) / high(1)) < _maxDojiShadowSizes) Then
			 ' Check whether the third candlestick matches. 
			If (open(0) < close(0) And _
				close(1) < close(0)) Then
				Return 3
			End If
		End If
	End If
	Return 0

Copyright © 2010 IQBroker, LLC. All rights reserved.