The Perfect Ever Moving Average 2


The Perfect Ever Moving Average 2
The Perfect Ever Moving Average 2

//www.aflcode.com
function Ehler1( x, V, n, w,f)
{y=x;
// acceleration + speed
a = x-2*Ref(x,-1) + Ref(x,-2);
s = f*(x-Ref(x,-1));
q=AMA(V*(abs(a)+abs(s))/x,w);

for( i = n-1; i < BarCount; i++ )
 {
   sy=0;sw=0;  
 for (j=i-n+1; j<i+1; j++)
  {sy = sy + q[j]*x[j]; 
   sw = sw + q[j];
  }
 y[i]=sy/sw;
 }
return y;
}
w=Param("w",0.62,0.05,0.99,0.01);
n=Param("n",8,1,42,1);
f=Param("f",-0.3,-10,10,0.1);
f=10^f;
eh=Ehler1(C,V,n,w,f);
Plot( Close, "Price", colorBlack, styleCandle );
Plot( eh, "Ehler", colorBlack ); 
Plot( MA(C,n), "MA", colorBlue ); 

Previous
Next Post »