.

Non Linear Filtering System - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Non Linear Filtering System

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", colorBlack, styleLine);
Plot(DCEF, "NonLinear Ehlers Filter", IIf(Close>DCEF, colorGreen, colorRed), styleLine);
Previous Post Next Post