- UID
- 2
- 积分
- 2892857
- 威望
- 1396460 布
- 龙e币
- 1496397 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
【PercentRankArray】
- inputs:
- PriceValueToRank( numericsimple ),
- PriceValueArray[MaxSize]( numericarrayref ),
- Size( numericsimple ) ;
- variables:
- var0( 0 ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ) ;
- condition1 = Size > 1
- and PriceValueToRank >= LowestArray( PriceValueArray, Size )
- and PriceValueToRank <= HighestArray( PriceValueArray, Size ) ;
- if condition1
- then
- begin
- Value1 = SortArray( PriceValueArray, Size, -1 ) ;
-
- var0 = 1 / ( Size - 1 ) ;
-
-
-
- var1 = 0 ;
- for Value2 = 1 to Size
- begin
- if PriceValueArray[Value2] = PriceValueToRank then
- begin
- PercentRankArray = var0 * ( Value2 - 1 ) ;
- var1 = 1 ;
- Value2 = Size ;
- end ;
- end ;
-
- if var1 = 0 then
- begin
- for Value3 = 1 to Size - 1
- begin
- var2 = PriceValueArray[Value3] ;
- var3 = PriceValueArray[ Value3 + 1 ] ;
- condition1 = PriceValueToRank > var2 and PriceValueToRank < var3 ;
- if condition1 then
- begin
- PercentRankArray = var0 * ( ( Value3 - 1 ) + ( PriceValueToRank -
- var2 ) / ( var3 - var2 ) ) ;
- Value3 = Size - 1 ;
- end ;
- end ;
- end ;
- end
- else
- PercentRankArray = -1 ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|