I have these two function, at least one is normed between -1 and +1.

double angle(double steep, double flat=0.0) { return((atan(steep)-atan(flat))/M_PI_2); } double angleDegr(double steep, double flat=0.0) { return((atan(steep)-atan(flat))*180.0/M_PI); } ... double steep, flat, ang1, ang2; steep = Prc_a1 - Prc_a2; flat = Prc_b1 - Prc_b2; ang1 = angle(flat); ang2 = angleDegr(flat);

You don't need (time1-time2) it's always 1 bar. But to get a kind of smoothing you can use the a time-difference of more than 1 bar!

Hi coders,

this indicator prints a text object as soon as a trendline is drawn. I found the calculation for the angle in the MQL5 forum but it doesn't work correctly. The angle in degrees is always wrong. Just the directon (above or below zero) works. Does anyone have made some experiences with that and can help me?