Saturday, September 04, 2010

Bullish Concealing Baby Swallow [UCBS]

Descripton
Rules:
1. The first candlestick is a red candlestick without shadows.
2. The second candlestick is a red candlestick without shadows.
3. The third candlestick gaps down below the second bar, it has a long upper shadow in the range of the second candlestick but it closes below the second candlestick.
4. The fourth candlestick is a red candlestick without shadows which engulfs the third candlestick including all of its shadow.

Pattern Type:
Bullish Reversal.


Variables
TypeIdentifierDescription
Integer_symbolIndexUse for the underlying symbol index on which to calculate the Bullish Concealing Baby Swallow.

OnInitialize
Function Parameters
TypeIdentifierDescription
SymbolsymbolIndexUse for the underlying symbol index on which to calculate the Bullish Concealing Baby Swallow.
Implementation
	 ' Assign the parameters to script variables.
	_symbolIndex = symbolIndex

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

Copyright © 2010 IQBroker, LLC. All rights reserved.