- UID
- 2
- 积分
- 2874674
- 威望
- 1387366 布
- 龙e币
- 1487308 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
【CoefficientRArray】
- inputs:
- IndepArray[MaxSize1]( numericarray ),
- DepArray[MaxSize2]( numericarray ),
- Size( numericsimple) ;
- variables:
- var0( 0 ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ),
- var4( 0 ),
- var5( 0 ),
- var6( 0 ),
- var7( 0 ) ;
- CoefficientRArray = -2 ;
- if Size > 0 then
- begin
- var0 = 0 ;
- var1 = 0 ;
- for Value1 = 1 to Size
- begin
- var0 = var0 + IndepArray[Value1] ;
- var1 = var1 + DepArray[Value1] ;
- end ;
- var0 = var0 / Size ;
- var1 = var1 / Size ;
- var4 = 0 ;
- var2 = 0 ;
- var3 = 0 ;
- for Value1 = 1 to Size
- begin
- var6 = IndepArray[Value1] - var0 ;
- var5 = DepArray[Value1] - var1 ;
- var4 = var4 + Square( var6 ) ;
- var2 = var2 + Square( var5 ) ;
- var3 = var3 + var6 * var5 ;
- end ;
- Value2 = var4 * var2 ;
- if Value2 > 0 then
- begin
- var7 = var3 / SquareRoot( Value2 ) ;
- condition1 = var7 >= -1 and var7 <= 1 ;
- if condition1 then
- CoefficientRArray = var7 ;
- end ;
- end ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|