Download MetaTrader 5

Secrets of MetaTrader 4 Client Terminal: Alerting System

13 September 2006, 14:45
8 497

    System Events

Open the "Tools -> Options" menu and go to the "Events" tab. By default, a WAV file is used to alert about one of eleven events.

These files can be found in the \MetaTrader 4\sounds\ directory of the Client Terminal. The alert can be modified as desired. To do so, open the popup list in the "Action" column by double-clicking with the left mouse button on the selected line.

The alert can be both a WAV file and an executable file ("EXE", "VBS", "BAT").

If a file of another type is chosen for alerting, the application related to this file type will be launched. After having selected an action, press Enter to confirm the choice. The event alert can be disabled by double-clicking with the left mouse button on the line in the "Event" column.

    User-Defined Events

Custom events can be of two types:

  • the price reaches the pre-defined value for the desired symbol;
  • the pre-defined timeout is reached.


To set up alert, you have to go to the "Alerts" tab in the "Terminal" window and press Insert.

The alerts can be enabled/disabled by pressing Space, and modified by pressing Enter.

Alerts can be of three types: a sound alert, an executable file, an emailed message. For all alert types, it is necessary to specify the "Symbol" and conditions (fields "Condition" and "Value"), at meeting of which the alert will trigger. In the fields named "Timeout" and "Maximum iterations", it should be specified how many times and with what regularity the alert will trigger.

    Sound Alerts

Both files stored in the \MetaTrader 4\sounds\ directory of the Client Terminal and any other files can be used as sound alerts: "WAV", "MP3", "WMI". If a file in the "MP3" or "WMI" format is chosen, the application related to these file types will be launched at alert triggering.

    Executable Files

Executable files can be in formats of "EXE", "VBS", "BAT". If a file of any other format has been chosen, the application related to these file types will be launched at alert triggering.

   Emailed Messages

To get alert messages via email, it is necessary to make presettins in the "Email" tab of the "Tools -> Options" menu. Check the "Enable" field and enter your email server settings in the corresponding fields. In each field, you can see red prompts about the data format to be entered.

  • SMTP server – address of your mailing server when accessed via SMTP. Please do not forget to specify the port number separated by a colon. It is usually port 25. Example:
  • SMTP login – it is usually your email address. Example:
  • SMTP password – a password used to access to your mailbox.
  • From: – you should enter the login ("Your name") and your email address on the same server, the SMTP of which you would like to use. As a rule, the login coincides with the first part of the email address, but it can be skipped. Example: your_name,
  • To: – email address you would like to send alerts to. The "Your name" part of the address can be skipped. In general, the "To:" field should be filled out with any real email address. Example: any_name,

Click on the "Test" button and check whether the message has been delivered to the email address you have specified in the "To:" field. If all settings have been written correctly, the message: "Mail: 'Test message' has been sent" must appear in the "Journal".

For sms messages to be sent, you have to specify the email address provided by your cellular operator in the "To:" field. To use the operator's SMTP server as such, you have to verify its settings on the operator's website or at the accounts department. At that, please keep in mind that not all cellular operators permit to use their SMTP servers without calling to POP3 servers.

Then the alert as such can be created. To do so, press Insert in the "Alerts" tab in the "Terminal" window. Fill out all the fields:

To create the message text, click on the  button near the "Source" line. Enter the subject and the body of the message. Both in the subject and in the message body, you can use "Macros". The list of macros is available from the context menu.

After this, click on the "Send" button.

Having filled out other fields, click on the "Test" button and check whether the alert has income at your mailbox. If the message has been sent successfully,  the corresponding record will appear in the "Journal":

    Publishing of Reports on FTP Server

The terminal allows publishing in internet reports about the account status on a periodic predetermined base.

For this, it is necessary to set up connection to the internet via FTP. Open the "Tools -> Options" menu and go to the "Publisher" tab.

The red color specifies the format to be used for entering the data.

The data transfer can be performed in either active or passive mode. The main deifference between them is the side that opens connection to transfer data. In the active mode, the FTP server initiates connection, and in the passive one, the customer does.

Periodicity is the minimal time intervalб with which the report will be published. At that, if a trading position or order changes in the terminal, the report will be forcedly and immediately published. This mechanism provides data accuracy (except for the current market price and the profit) in the report.

After all settings have been made, click on the "Test" button. If the report has been successfully sent, the corresponding line will appear in the "Journal".


Translated from Russian by MetaQuotes Software Corp.
Original article:

Last comments | Go to discussion (16)
MQL4 Comments
MQL4 Comments | 15 Dec 2008 at 02:06
How do I disable the alert window from poping up?
victor | 12 Mar 2009 at 21:58

how to make metatrader to alert for following events:

1- a position closed by TP

2- a position closed by SL

3- a position closed manualy

4- a candle closes ( a tick alert to be played)

5- a position becomes closer to SL (as SL box color turns red)

6- a position becomes closer to TP (as TP box color turns green)

any help much appritiated


xxxxxxx yyyyy
xxxxxxx yyyyy | 7 Mar 2010 at 06:05

hi all,

i got this error message

11:38:59 Mail: 530 5.7.0 Must issue a STARTTLS command first. 23sm1252103ywh.0
11:38:59 Mail: 'Test message' failed

what is the solution?

dipea71 | 20 Oct 2013 at 14:13

hi all,

i got this error message

11:38:59 Mail: 530 5.7.0 Must issue a STARTTLS command first. 23sm1252103ywh.0
11:38:59 Mail: 'Test message' failed

what is the solution?

Pankaj Bhatlawande
Pankaj Bhatlawande | 3 Mar 2015 at 12:09
Can you make alerts for indicators?/ I mean when there is a crossing of MA200, or RSI etc.???
Hey, are you able to solve your problem.
Step on New Rails: Custom Indicators in MQL5 Step on New Rails: Custom Indicators in MQL5

I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.

Here Comes the New MetaTrader 5 and MQL5 Here Comes the New MetaTrader 5 and MQL5

This is just a brief review of MetaTrader 5. I can't describe all the system's new features for such a short time period - the testing started on 2009.09.09. This is a symbolical date, and I am sure it will be a lucky number. A few days have passed since I got the beta version of the MetaTrader 5 terminal and MQL5. I haven't managed to try all its features, but I am already impressed.

Portfolio trading in MetaTrader 4 Portfolio trading in MetaTrader 4

The article reveals the portfolio trading principles and their application to Forex market. A few simple mathematical portfolio arrangement models are considered. The article contains examples of practical implementation of the portfolio trading in MetaTrader 4: portfolio indicator and Expert Advisor for semi-automated trading. The elements of trading strategies, as well as their advantages and pitfalls are described.

False trigger protection for Trading Robot False trigger protection for Trading Robot

Profitability of trading systems is defined not only by logic and precision of analyzing the financial instrument dynamics, but also by the quality of the performance algorithm of this logic. False trigger is typical for low quality performance of the main logic of a trading robot. Ways of solving the specified problem are considered in this article.