- UID
- 2
- 积分
- 2893117
- 威望
- 1396590 布
- 龙e币
- 1496527 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
【AdaptiveMovAvg】
- inputs:
- PriceValue( numericseries ),
- EffRatioLen( numericsimple ),
- FastAvgLen( numericsimple ),
- SlowAvgLen( numericsimple ) ;
-
- variables:
- var0( 0 ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ),
- var4( 2 / ( SlowAvgLen + 1 ) ),
- var5( 2 / ( FastAvgLen + 1 ) ),
- var6( var5 - var4 ) ;
-
- if CurrentBar = 1 then
- AdaptiveMovAvg = PriceValue
- else
- begin
- var0 = AbsValue( PriceValue - PriceValue[ EffRatioLen ] ) ;
- var1 = Summation( AbsValue( PriceValue - PriceValue[1] ), EffRatioLen ) ;
- if var1 > 0 then
- var2 = var0 / var1
- else
- var2 = 0 ;
-
- var3 = Square( var4 + var2 * var6 ) ;
- AdaptiveMovAvg = AdaptiveMovAvg[1] + var3 * ( PriceValue - AdaptiveMovAvg[1] ) ;
- end ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|