【AdaptiveMovAvg】
[code]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 ;
[/code]
页:
[1]