EMA with alert - simple 50 EMA

Hi all,

new to MQL4.

I would like to build a simple 50 EMA that send out an email to me when price closed below or above it.

Can anyone can give me some codes to start with?

Thank in advance.

Use macd with alerts and set the fast ema period to 1 and slow period to ema period that you want to use: that will be exactly the same as what you are looking for

Thank you Mladen. Did you mean just use the MACD indicator directly instead of using MQL4 to code?

Anyway I just tried to play around withthe MACD indicator in MT4 directly. There’s no option for me to set any alert.

Thanks all

Ok. I will google for that and try to learn from the codes :slight_smile:

thank you.