Skip to main content

Ehlers Optimal Tracking Filter for Amibroker (AFL)

skornet almost 12 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 8)
  • Tags:
    amibroker

Ehlers Optimal Tracking Filter slow and fast

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Optimal Slow Tracking Filter");

Plot(C, "", colorBlack, styleCandle);
price = ParamField("Price field", 3);

Period1=Param("Period of Smoothing OTF",9,1,30,1);
Period2=Param("Period of Slowing OTF",3,1,25,1);
koef = Param( "koefsmoofs", 8, 2, 15, 1 );
koe = Param( "koesmoofs", 16, 3, 25, 1 );

SC=2/(Period1+1);
MPr=(HHV(H,Period2)+LLV(L,Period2))/2;
                        
Val1 = AMA(MPr-Ref(MPr,-1), SC);

Val2=AMA((HHV(H,Period2)-LLV(L,Period2))/2, SC);    

Lamb=IIf(Val2!=0,abs(Val1/Val2), 0);

Alpha=(-Lamb*Lamb+Lamb*sqrt(Lamb*Lamb+koe))/koef;//koe

Val3= AMA( price, Alpha);

Plot(Val3,"Sm Slow OTF", ParamColor(
"Sm Slow OTF", colorBlack ), ParamStyle("Style S", styleNoLabel|styleDots) );

///////////////////////    Fast   //////////

pric = ParamField("Pric field", 3);
Period=Param("Period OTF",9,1,30,1);
koef1 = Param( "koefsmoof", 8, 2, 15, 1 );
koe1 = Param( "koesmoof", 16, 3, 25, 1 );

SC1=2/(Period+1);

MPr1=(H+L)/2;
     
Vl1 = AMA(MPr1-Ref(MPr1,-1), SC1);
              
Vl2 = AMA((H-L)/2, SC1);

Lmb=IIf(Vl2!=0,abs(Vl1/Vl2), 0);

Alph=(-Lmb*Lmb+Lmb*sqrt(Lmb*Lmb+koe1))/koef1;//koe1

Vl3 = AMA(pric, Alph);

Plot(Vl3,"Smoothing OTF", ParamColor(
"Smoothing OTF", colorRed ), ParamStyle("Style", styleNoLabel|styleDots));

/////////////////////////////////////////////////////
_SECTION_END();

4 comments

almost 12 years ago

I think you should buy when red line cross above black line, and sell when red cross below the black line.

3. skornet
almost 12 years ago

“I think you should buy when red line cross above black line, and sell when red cross below the black line”-says Vinitrader-YES.

Leave Comment

Please login here to leave a comment.