【RS_ReversalPatterns】
[code]inputs:RevDirection( numericsimple ),
RevCriteria( numericsimple ),
GapSizeFactor( numericsimple ),
DataArray[ Twelve, MaxNumDays ]( numericarray ),
Index( numericsimple ),
SubArray[ Three ]( numericarray ),
oSetup( numericref ),
oTrigger( numericref ) ;
variables:
var0( false ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
var7( 0 ),
var8( 0 ),
var9( 0 ),
var10( 0 ),
var11( 0 ),
var12( 0 ),
var13( 0 ),
var14( 0 ),
var15( 0 ),
var16( 0 ),
var17( 0 ),
var18( false ),
var19( 0 ),
var20( 0 ) ;
var0 = CurrentBar = 1 or Date <> Date[1] ;
if var0 then
begin
var1 = MaxNumDays + 1 ;
var2 = Mod( Index + 1, var1 ) ;
var3 = Mod( Index + 2, var1 ) ;
var4 = DataArray[ 1, var2 ] ;
var5 = DataArray[ 2, var2 ] ;
var6 = DataArray[ 3, var2 ] ;
var7 = DataArray[ 4, var2 ] ;
var8 = DataArray[ 4, var3 ] ;
var9 = DataArray[ 9, var2 ] ;
var10 = var7 - var4 ;
var11 = var8 - DataArray[ 1, var3 ] ;
var12 = MaxList( var7, var4 ) ;
var13 = MinList( var7, var4 ) ;
var14 = ( var5 + var6 ) * .5 ;
var15 = DataArray[ 1, Index ] ;
end ;
var16 = DataArray[ 2, Index ] ;
var17 = DataArray[ 3, Index ] ;
if var19 > 0 then
begin
var18 = false ;
var19 = 0 ;
end ;
if RevCriteria = 1 then
begin
if RevDirection = 1 then
begin
if var0 then
begin
var20 = var15 - var5 ;
var18 = var10 > 0 and var20 > var9 *
GapSizeFactor ;
end ;
condition1 = var18 and ( var16 - var15 >= var20 * .5 or IffLogic(
DataArray[ 12, Index ] = SubArray[3], SubArray[2] < var5, false ) ) ;
if condition1 then
var18 = false ;
if var18 then
var19 = Iff( Low < var5, var5, 0 ) ;
end
else if RevDirection = 2 then
begin
if var0 then
begin
var20 = var6 - var15 ;
var18 = var10 < 0 and var20 > var9 *
GapSizeFactor ;
end ;
condition1 = var18 and ( var15 - var17 >= var20 * .5 or IffLogic(
DataArray[ 12, Index ] = SubArray[3], SubArray[1] > var6, false ) ) ;
if condition1 then
var18 = false ;
if var18 then
var19 = Iff( High > var6, var6, 0 ) ;
end ;
end
else if RevCriteria = 2 then
begin
if RevDirection = 1 then
begin
if var0 then
var18 = var11 > 0 and var12 <= var14
and var13 >= var8 ;
condition1 = var18 and IffLogic( DataArray[ 12, Index ] = SubArray[3], SubArray[2] <
var6, false ) ;
if condition1 then
var18 = false ;
if var18 then
var19 = Iff( Low < var6, var6, 0 ) ;
end
else if RevDirection = 2 then
begin
if var0 then
var18 = var11 < 0 and var13 >= var14
and var12 <= var8 ;
condition1 = var18 and IffLogic( DataArray[ 12, Index ] = SubArray[3], SubArray[1] >
var5, false ) ;
if condition1 then
var18 = false ;
if var18 then
var19 = Iff( High > var5, var5, 0 ) ;
end ;
end ;
oSetup = Iff( var18, 1, 0 ) ;
oTrigger = var19 ;
RS_ReversalPatterns = 1 ;
[/code]
页:
[1]