Skip to main content

EMA Slope for Amibroker (AFL)

wisp almost 9 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 6)
  • Tags:
    oscillator, amibroker

EMA color changes based on slope

Screenshots

Indicator / Formula

Copy & Paste Friendly
P = Param("EMA PERIOD",20,2,90,1);
q = Param("WINDOW SIZE FOR CALCULATING SLOPE", 1,1,20,1);
r = Param("SLOPE CHANGE SMOOTHING FACTOR",5,1,50,1);
e = EMA(C, P);
Slope = atan((e - Ref(e,-q)) / (q * 3.14159265)) * 180;
m = MA(Slope,r);
Plot(Slope,"Slope", IIf(Slope>0,colorBlue,colorRed),styleHistogram|styleThick);
Plot(m,"Direction",IIf(m>Ref(m,-1),colorBlue,colorRed),styleThick);

4 comments

over 2 years ago

Just wanted to say thanks! BTW you can make the direction line in front by changing the z-order:

Plot(m,“Direction”,IIf(m>Ref(m,-1),colorBlue,colorRed),styleThick,Null,Null,Null,1);

Leave Comment

Please login here to leave a comment.