【Median】
[code]inputs: PriceValue( numericseries ), Len( numericsimple ) ;variables: var0( 0 ), var1( 0 ) ;
arrays: arr0[1000]( 0 ) ;
for Value1 = 1 to Len
begin
arr0[Value1] = PriceValue[ Value1 - 1 ] ;
end ;
Value1 = SortArray( arr0, Len, 1 ) ;
var0 = Len * .5 ;
var1 = IntPortion( var0 + 1 ) ;
if FracPortion( var0 ) = 0 then
Median = ( arr0[var0] + arr0[ var0 + 1 ] ) * .5
else
Median = arr0[ var1 ] ;
[/code]
页:
[1]