Skip to main content

Distance Coefficient Ehlers Filter for Amibroker (AFL)

UnknownZ over 15 years ago Amibroker (AFL)

  • Rating:
    2 / 5 (Votes 3)
  • Tags:
    amibroker, ehler

Rocket Science for Traders: Digital Signal Processing Applications.

The Distance Coefficent Ehlers Filter is a type of filter in the non-linear FIR (Finite Impulse Response) filter class. This type of filter is great for filtering out pricing data that isn’t stationary. ie, cycling.

It can be used similarly to the SMA (Simple Moving Average) or the EMA (Exponential Moving Average). There is more to it than that, but the details are better understood by reading his book. I’ve found the Distance Coefficient Ehlers Filter to be much more responsive than either the Simple Moving Average, or the Exponential Moving Average, but it also has to do with the stationary vs non-stationary response that the stock is undergoing.

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("EhlersDistCoefFilter");

//EhlersDistCoefFilter
//Taken from the article in TASC's April 2001 Issue.

Price = (H+L)/2;
CoefLookback = 5;

Coef = (Price-Ref(Price, -1))^2+(Price-Ref(Price, -2))^2+(Price-Ref(Price, -3))^2+(Price-Ref(Price, -4))^2+(Price-Ref(Price, -5))^2;

SumCoef=0;
SumCoefPrice=0;
for(i=0; i < CoefLookback; i++) {
	SumCoef = SumCoef + Ref(Coef, -i);
	SumCoefPrice = SumCoefPrice + (Ref(Coef, -i) * Ref(Price, -i));
}
DCEF = SumCoefPrice / SumCoef;

Plot(Close, "Close", colorWhite, styleLine);
Plot(DCEF, "NonLinear Ehlers Filter", IIf(Close>DCEF, colorGreen, colorRed), styleLine);
_SECTION_END();

2 comments

Leave Comment

Please login here to leave a comment.