【PivotReversalGen】
[code]inputs:MinRStren( numericsimple ),
MaxRStren( numericsimple ),
LRFactor( numericsimple ),
HiLo( numericsimple ),
DrawLines( truefalsesimple ),
LinesColor( numericsimple ),
oPivotPriceValue( numericref ),
oPivotRStren( numericref ),
oPivotLStren( numericref ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
var7( 0 ),
var8( 0 ),
var9( 0 ),
var10( 0 ) ;
arrays:
arr0[ 1001, 4 ]( 0 ) ;
if HiLo = 1 then
var0 = High
else if HiLo = -1 then
var0 = Low ;
var1 = CurrentBar ;
var2 = 0 ;
PivotReversalGen = 0 ;
if var1 = 1 then
begin
arr0[ 1001, 1 ] = HiLo * 10000000 ;
arr0[ 1000, 1 ] = var0 ;
arr0[ 1000, 2 ] = 1 ;
arr0[ 1000, 3 ] = Date ;
arr0[ 1000, 4 ] = Time ;
var3 = 1000 ;
var4 = 1001 ;
end
else for var5 = var3 to var4
begin
var6 = var5 + 1 ;
var7 = var5 - 1 ;
condition1 = Hilo * var0 > HiLo * arr0[ var5, 1 ] ;
if condition1 then
begin
var8 = var1 - arr0[ var5, 2 ] - 1 ;
var9 = arr0[ var5, 2 ] - arr0[ var6, 2 ] - 1 ;
condition1 = var8 >= MinRStren and var8 <= MaxRStren and IffLogic( LRFactor > 0,
var9 > var8 * LRFactor, var9 >= MinRStren ) ;
if condition1 then
begin
var2 = var2 + 1 ;
if var2 = 1 then
begin
oPivotPriceValue = arr0[ var5, 1 ] ;
oPivotRStren = var8 ;
oPivotLStren = var9 ;
PivotReversalGen = 1 ;
end ;
if DrawLines then
begin
var10 = TL_New( arr0[ var5, 3 ], arr0[ var5, 4 ], arr0[ var5,
1 ], Date, Time, arr0[ var5, 1 ] ) ;
TL_SetColor( var10, LinesColor ) ;
TL_SetExtLeft( var10, false ) ;
TL_SetExtRight( var10, false ) ;
end ;
end ;
end
else
begin
arr0[ var7, 1 ] = var0 ;
arr0[ var7, 2 ] = var1 ;
arr0[ var7, 3 ] = Date ;
arr0[ var7, 4 ] = Time ;
var3 = var7 ;
var5 = var4 ;
end ;
end ;
if false then
Value1 = PivotReversalGen[1] ;
[/code]
页:
[1]