【Mode】
[code]inputs:PriceValue( numericseries ),
Len( numericsimple ),
Type( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( -1 ),
Value2( 0 ) ;
arrays:
arr0[1000]( 0 ) ;
if Len > 1 then
begin
for Value1 = 1 to Len
begin
arr0[Value1] = PriceValue[ Value1 - 1 ] ;
end ;
Value1 = SortArray( arr0, Len, -1 ) ;
var0 = 1 ;
var1 = 1 ;
var2 = -1 ;
for Value2 = 1 to Len - 1
begin
condition1 = arr0[Value2] = arr0[ Value2 + 1 ] ;
if condition1 then
var0 = var0 + 1
else
var0 = 1 ;
condition1 = var0 > 1 and var0 >= var1 ;
if condition1 then
begin
if var0 > var1 then
begin
var2 = arr0[Value2] ;
var1 = var0 ;
end
else
begin
condition1 = var0 = var1 and Type >= 0 ;
if condition1 then
var2 = arr0[Value2] ;
end;
end ;
end ;
end ;
Mode = var2;
[/code]
页:
[1]