【Pivot】
[code]inputs:PriceValue( numericseries ),
Len( numericsimple ),
LeftStrength( numericsimple ),
RightStrength( numericsimple ),
Instance( numericsimple ),
HiLo( numericsimple ),
oPivotPriceValue( numericref ),
oPivotBar( numericref ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( false ),
var5( false ) ;
var3 = 0 ;
var5 = false ;
var1 = RightStrength ;
while var1 < Len and var5 = false
begin
var0 = PriceValue[var1] ;
var4 = true ;
var2 = var1 + 1 ;
while var4 = true and var2 - var1 <= LeftStrength
begin
condition1 = ( HiLo = 1 and var0 < PriceValue[var2] )
or ( HiLo = -1 and var0 > PriceValue[var2] ) ;
if condition1 then
var4 = false
else
var2 = var2 + 1 ;
end ;
var2 = var1 - 1 ;
while var4 = true and var1 - var2 <= RightStrength
begin
condition1 = ( HiLo = 1 and var0 <= PriceValue[var2] )
or ( HiLo = -1 and var0 >= PriceValue[var2] ) ;
if condition1 then
var4 = false
else
var2 = var2 - 1 ;
end ;
if var4 = true then
var3 = var3 + 1 ;
if var3 = Instance then
var5 = true
else
var1 = var1 + 1 ;
end ;
if var5 = true then
begin
oPivotPriceValue = var0 ;
oPivotBar = var1 + ExecOffset ;
Pivot = 1 ;
end
else
begin
oPivotPriceValue = -1 ;
oPivotBar = -1 ;
Pivot = -1 ;
end ;
[/code]
页:
[1]