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