- UID
- 2
- 积分
- 2893117
- 威望
- 1396590 布
- 龙e币
- 1496527 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
【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 ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|