Expert Advisor that Finds Absolute Value of EMA’s and Sends Email


Q:  Hi!  I would like to create an EA that compares the distance between two EMAs (EMA10 and EMA20) across two periods say the current and the previous period.  Can I do this in the VTS? 


A: Yes, you can. Wach the video below to see how.

In this video I get the absolute value of two sets of Exponential Moving Averages (EMA).   Then I  compare them and send an email if one is greater than the other.

The key to this EA is using the MQL function MathAbs to find the  absolute value.  In this case, you need to manually type the values into the variable assignment field like this:
MathAbs(_EMA13_0 – _EMA26_0)
MathAbs(_EMA13_1 – _EMA26_1)

This is not ideal because you can create a syntax error entering this text. As a matter of fact, I did exactly that when I created this video. (I swear it was not on purpose for dramatic effect!)  I also show how to find and correct the error.

I’m always looking for better ways. There is an “equation editor” on the variable assignment field, but I don’t think it’s real useful.  if you have any ideas, please pass them along.




To get notified about the latest questions and answers, follow us!