Saturday, September 04, 2010

Bullish Side-By-Side White Lines [USWL]

Descripton
Rules:
1. The first candlestick is a green candlestick.
2. The second candlestick is a green candlestick which gaps above the first candlestick.
3. The third candlestick is a green candlestick which opens near the open of the second candlestick and closes near the close of the second candlestick.

Pattern Type:
Bullish Reversal.


Variables
TypeIdentifierDescription
Integer_symbolIndexUse for the underlying symbol index on which to calculate the Bullish Side-By-Side White Lines.
Number_maxDifferenceUse for the maximum percentage difference between two values in order for them to still be considered equal.

OnInitialize
Function Parameters
TypeIdentifierDescription
SymbolsymbolIndexUse for the underlying symbol index on which to calculate the Bullish Side-By-Side White Lines.
NumbermaxDifferenceUse for the maximum percentage difference between two values in order for them to still be considered equal. [Default 0.2]
Implementation
	 ' Assign the parameters to script variables.
	_symbolIndex = symbolIndex
	_maxDifference = maxDifference

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 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)) Then
		 ' Check whether the second candlestick matches.
		If (open(1) < close(1) And _
			open(1) > high(2)) Then
			 ' Check whether the third candlestick matches.
			If (open(0) < close(0) And _
				100 * MathAbs((open(0) - open(1)) / open(1)) < _maxDifference And _
				100 * MathAbs((close(0) - close(1)) / close(1)) < _maxDifference) Then
				Return 3
			End If
		End If
	End If
	Return 0

Copyright © 2010 IQBroker, LLC. All rights reserved.