【VarianceArray】
[code]inputs:PriceValueArray[MaxSize]( numericarray ),
Size( numericsimple ),
DataType( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ) ;
VarianceArray = 0 ;
var0 = Iff( DataType = 1, Size, Size - 1 ) ;
if var0 > 0 then
begin
var2 = AverageArray( PriceValueArray, Size ) ;
var1 = 0 ;
for Value1 = 1 to Size
begin
var1 = var1 + Square( PriceValueArray[Value1] - var2 ) ;
end ;
VarianceArray = var1 / var0 ;
end ;
[/code]
页:
[1]