We'll go over on how to make email notifications in MQL4 indicators in this post. But first, let's go over what MQL4 is, what a MQL4 alert is, why traders use alerts, and when we should use them.
MetaQuotes Language (MQL4) is a trading strategy development language that allows you to build trading robots, technical indicators, scripts, and feature libraries for use on the MetaTrader4 trading platform. Both of these tools greatly improve traders' Forex trading skills.
MataQuotes Language 4 is based on the common C++ programming language's concepts. MQL4 is also an object-oriented programming language with a high level of abstraction. Because of the language's speed and versatility, you can build very complex programs with a lot of calculations and handle almost all Expert Advisor and indicator parameters accurately. It also has built-in basic indicators and functions for handling and monitoring trading orders, as well as a wide range of functions for analyzing current and previously obtained quotes.
What is a Metatrader Alert, and how does it work?
The trading platform Metatrader includes an Alert feature. Its aim is to inform the trader when a certain market requirement is met.
What is the aim of a trader's alert?
Traders frequently want to be able to look away from their computer screens and away from their maps. However, they don't want to miss out on a possible deal that they've been waiting for. This is where alerts will make a trader's life a little easier. A trader may be alerted if a certain condition is met by setting a alert.
Types of Alerts
You will get updates from your Metatrader platform in two ways. The first choice is to use MT4's built-in Alert feature. The second choice is to use a custom indicator that runs within MT4. The first approach will be covered in this course: using the Alert service that comes with MT4.
When do you use an alert?
It's crucial to think about the type of alerts you'll use and how it'll fit into your trading style. If you scalp a few pips as the price goes up and down, alerts are unlikely to help you. The trading opportunity has most likely passed by by the time you receive the alerts and return to your device. A sound alert will also arrive almost instantly, while an email alert can take minutes to navigate the internet and reach you. Many traders believe that alert other than sound are better used with trading strategies that use one hour and higher charts. Since there isn't a hurry to get to the chart and set a trade, any delay in getting a alert has less of an impact.
Note: If you're using an email client on your machine, make sure it scans for new emails on a regular basis. Every minute, my email client is set to receive emails. It was originally set to receive every 15 minutes, which is a very long time for trading!
IN MQL4, HOW DO I Generate AN EMAIL ALERT?
For a long time, traders have flocked to the Mail Alert service. It's likely that it's being used less these days, as more traders use the Notification feature to receive notifications directly on their tablets. Nonetheless, it continues to play an important role in the lives of many traders.
Click Mail from the dropdown arrow next to Action.
To the right of the Source text box, click the Ellipsis button.
This will open up the following popup window:
As you would any other email application, treat this one the same way. Fill in the subject line and the message's body. The most straightforward method is to write directly into these regions. There is, however, a simpler way to get a much more informative email so you know exactly what happened when the alarm was activated!
Macros can be used in both the header and body parts of an email. A popup appears when you right-click in the message body. When you hover your cursor over the Macro arrow, a new popup appears, allowing you to choose from a list of predefined macros:
Here's an example of how to compose an email:
Simply use the macro facility to insert the actual Symbol, Bid price, Ask price, and so on into the email.
Keep in mind that your ISP will use spam filters to try to screen out any of the spam before it reaches you. As a result, if the header contains a large number of non-alphanumeric characters, the email can be misidentified as spam. As a result, if you used the identifier "$$$$
We need to make sure you can send the email now that you know how to view and write it. Although this seems to be a simple method, it is made more difficult by the fact that Metatrader does not support SSL authentication, which is used by many email services. (SSL stands for Safe Sockets Layer, which is a cryptographic protocol that allows for secure internet communication.)
If you have an email account with your Internet Service Provider (ISP), you have most likely obtained information about it from them. Examine those specifics to see if your service employs the SSL protocol.
Alternatively, go to their customer support website, like many ISPs make their internet settings available to clients. Alternatively, check your email client's account settings to see if SSL is activated, or contact your ISP directly. You'll also need your email address at some point.
I can see that the tick box beside SSL is unchecked in my Outlook Account Settings, indicating that my account does not use SSL protocol.
Email setup is relatively simple for those who use an email client that does not use SSL authentication. To begin, go to Tools Options.
Select the Email option from the drop-down menu.
Check that the Enable checkbox is selected. Then, using the information you gathered earlier, fill in the blanks. In most cases, the same email address is used in both the “From” and “To” fields. It makes no difference what you use as long as it is in the context of a standard email address.
After you've filled in all of the necessary details, click the Test button (shown above).
To see if the email test was good, go to the Journal tab in the terminal window.
MT4 sent the message successfully, as shown by Message 1. This indicates that the above-mentioned settings have been approved by MT4. It returned the error at message 2 when I changed the To field and used an illegitimate email address.
The existence of Message 1 does not guarantee that the message will be delivered. You could have entered an incorrect email address or server name, resulting in the message being lost. So, go ahead and check your email if the message was sent.
SSL authentication is used by a number of common email clients, including Hotmail, Yahoo Mail, Gmail, and many others. This means that if you want MT4 to send an email to your gmail account, you'll need to use SMPT relay software like GMX or another kind.
MT4 Email -> GMX Gmail -> Server is an example of the procedure.
In this example, we'll create a GMX account so that MetaTrader can send emails to a Gmail account. To begin, go to http://www.gmx.com/ and build an account – it's free and simple.
Then, by selecting Tools Options, open the Options window.
1. Make sure the checkbox next to "Enable" is selected.
2. Next, enter the name of the "SMTP Server" as well as your GMX username and password. The “:587” appended to the server address indicates that the mail server will use port 587.
3. Fill in the "From" field with the same GMX email address.
4. In the "To" area, type the email address to which you want the email sent.
Now press the Test button and look at the message in Terminal's Journal tab. The Journal would display "Mail: 'Test letter' has been sent" if the message was successfully sent.
Now go to your Gmail account and log in. You should have received a message sent from MT4 via GMX in your inbox. In my experiments, refreshing the GMX inbox after sending a message from MT4 resulted in receiving a message within a few seconds.
Publication of knowledge
This function of MT4 can be extremely useful in alerting a trader when a price level or other requirement is reached. When an alarm is activated, you will receive a push notification to your mobile device. If you're not sure if you'll be near your phone, this is possibly the easiest way to send a alert.
Thank you for reading