MT4 Email Alert – Setup Your MetaTrader in 4 Easy Steps

mt4 email alert

Greetings friends!

In this short article we will discuss how to setup your Expert Advisor so to get an MT4 email alert every time a significant event occurs. A significant event can be anything like successful execution of an order, or a position being closed at StopLoss, or even simply the price crossing a certain level. It’s up to you to decide when you want your FX Robot to send an email notification.

Step 1 – Open a Gmail Account

It is important to understand that MetaTrader 4 cannot send an MT4 email alert on its own. The only way your trading platform can do this is through an existing email account.

Of course, for this purpose you can use your personal email account. However, that way you may run into complications when configuring the SMTP server. Gmail is tried and tested, and generally speaking, I find that this is the easiest approach. I created myself one just now:
gmail account

One more thing.. You know how Gmail allows you to set up two-step verification? Well, this time don’t do it. MetaTrader 4 will not be able to access your Gmail account if two-step verification is in place.

After you’re done, you can logout of your new Google account. You won’t ever need to log into it again.

Step 2 – MetaTrader 4 Settings

Open your MT4 trading platform and go to Tools -> Options or simply click CTRL+O. Now enter the following settings in the Email tab:

email setup

The “SMTP login” and the “From” fields are identical and should reflect the Gmail account you set up in Step 1. The “To” field is where you want your emails to go, i.e. your private email address where you want your MT4 email alert to be delivered.

It so happens that my private email address is also hosted on Gmail. But yours can be anywhere – yahoo / mail.com / gmx / even an email on your personal website. Literally any email address you use can go in this field.

Click OK.

After you have completed this step it is absolutely imperative that you restart MetaTrader 4. Your settings won’t work until you restart the platform.

Step 3 – Test The Configuration

Once you have restarted the platform, go back to the options screen and click the “Test” button. You will get the following message:

test email

It may take the email a couple of minutes to be sent (not more than 5 minutes). If you have set up everything correctly, then the terminal journal should eventually display the following message:

MT4 email alert

If something is wrong, the trading terminal will let you know by displaying an error message in the journal.

Check your personal email – you should have received the test message:

mql4 email

Step 4 – Send an MT4 Email Alert

Finally, everything has been set up and we can send an MT4 email alert from within our own algorithmic trading system. Today I will quickly show you how it’s conceptually done in MQL4, and next time we will go into a bit more detail.

Open MQL4 and create an empty script. Copy-paste the following code:
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
SendMail("MT4 Email Alert", "Hey there! Just letting you know that you have just "+
"made a profit on your FOREX account! Good job.");
}
//+------------------------------------------------------------------+

Now compile the script and launch it on any chart in your trading platform.

Check your email. If everything has been done according to the instructions above, you should see the following message:

metatrader 4 email alert

 

There you go! Now you know how to send an MT4 email alert from within your expert advisor, script or indicator.

 

Did you find these instructions useful? Then make sure to check out the next post where we talk about how to add useful information to your MT4 SendMail function.

Kind regards,

Kirill

What are you waiting for?

START LEARNING FOREX TODAY!

share This:
Team ForexBoat
Team ForexBoat

Our goal is to share this passion with others and guide newbies to avoid costly mistakes. Today we want to share all our knowledge and insights, so you can take your trading skills to the next level.

What are you waiting for?

START LEARNING FOREX TODAY!

as seen on: