- UID
- 2
- 积分
- 2892977
- 威望
- 1396520 布
- 龙e币
- 1496457 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
【LinearRegFC】
- inputs:
- PriceValue( numericseries ),
- Len( numericsimple ),
- TgtBar( numericsimple ),
- oLRSlope( numericref ),
- oLRAngle( numericref ),
- oLRIntercept( numericref ),
-
- oLRValueRaw( numericref ) ;
- variables:
- var0( 0 ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ),
- var4( 1 / 6 ),
- var5( 0 ) ;
- if Len > 1 then
- begin
- var2 = Len * ( Len - 1 ) * .5 ;
- var3 = Len * ( Len - 1 ) * ( 2 * Len - 1 ) * var4 ;
- var5 = Square( var2 ) - Len * var3 ;
- var0 = 0;
- for Value1 = 0 to Len - 1
- begin
- var0 = var0 + Value1 * PriceValue[Value1] ;
- end ;
- var1 = Summation( PriceValue, Len ) ;
- oLRSlope = ( Len * var0 - var2 * var1) / var5 ;
- oLRAngle = ArcTangent( oLRSlope ) ;
- oLRIntercept = ( var1 - oLRSlope * var2 ) / Len ;
- oLRValueRaw = oLRIntercept + oLRSlope * ( Len - 1 - TgtBar ) ;
- LinearRegFC = 1 ;
- end
- else
- LinearRegFC = -1 ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|