【TrimMean】
[code]inputs:PriceValue( numericseries ),
Len( numericsimple ),
TrimPct( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ) ;
array:
arr0[1000]( 0 ) ;
var0 = IntPortion( Len * TrimPct * .5 ) ;
condition1 = var0 > 0 and var0 < Len * .5 ;
if condition1 then
begin
for Value1 = 1 to Len
begin
arr0[Value1] = PriceValue[ Value1 - 1 ] ;
end ;
Value1 = SortArray( arr0, Len, -1 ) ;
var1 = 0 ;
for Value2 = 1 + var0 to Len - var0
begin
var1 = var1 + arr0[Value2] ;
end ;
TrimMean = var1 / ( Len - 2 * var0 ) ;
end
else
TrimMean = -1 ;
[/code]
页:
[1]