NotifyMe for MT4
- Utilitys
- Denis Zyatkevich
- Version: 1.1
- Aktualisiert: 27 September 2018
- Aktivierungen: 5
Overview
The Expert Advisor sends notifications to a mobile phone, via e-mail or activates an audio alarm in case any changes are detected on the trading account: opening/closing positions, changing order parameters, balance or leverage. Also, the Expert Advisor can inform that Equity on the trading account has dropped below a specified value or Free Margin is small compared to Margin. The Expert does not trade, it only monitors your account.
Launching the Expert Advisor
For the Expert Advisor to work, place the file NotifyMe.ex4 in terminal_folder/experts (probably it will be placed there automatically). NotifyMe should appear in the Expert Advisors section of the Navigator window. If not, restart the MetaTrader 4 terminal.
For the Expert Advisor to work, allow using Expert Advisors in the setting of MetaTrader 4. To do it, go to Tools menu, then Options, and then select Expert Advisors tab. Enable the option Enable Expert Advisors (except the Custom Indicators and Scripts).
To launch the Expert Advisor, right-click its name in the Navigator window and select "Attach to chart" or drag and drop it on the chart by mouse. The windows of the Expert Advisor's parameters will appear. Set the desired parameters and click OK.
The Expert Advisor can be attached to the chart of any financial instrument Since the EA analyzes the trade account state at every tick coming, to decrease delays of notifications it is recommended to run the EA on a symbol, where ticks come most often (for example, one of Forex currency pairs:: EURUSD, GBPUSD, USDCHF or USDJPY). on any time frame.
Expert's Input Parameters
- Push_Notify_Events - select what events you want to be notified of via your mobile terminal (0 - notifications disabled, 1 - notifying only of opening/closing positions, 2 - notifying of all events);
- Push_Notify_Critical_Equity - critical value of (Equity) on the trade account (in deposit currency). When this value is reached, the notification is sent to the mobile terminal;
- Push_Notify_Critical_Margin - critical value of Free Margin comparing to Margin in percentage terms. When this value is reached, the notification is sent to the mobile terminal;
- Push_Repeat_Interval - minimum time interval (in seconds) between sending push notifications in case the critical level of free margin of equity is reached;
- Push_Notify_Interval - minimum time interval (in seconds) between notifications sent to the mobile terminal;
- Push_Length_Limit - maximum length of a message sent to the mobile terminal;
- Mail_Notify_Events - select what events you want to be notified of via e-mail (0 - notifications disabled, 1 - notifying only of opening/closing positions, 2 - notifying of all events);
- Mail_Notify_Critical_Equity - critical value of (Equity) on the trade account (in deposit currency). When this value is reached, the notification is sent via e-mail;
- Mail_Notify_Critical_Margin - critical value of Free Margin comparing to Margin in percentage terms. When this value is reached, the notification is sent via e-mail;
- Mail_Repeat_Interval - minimum time interval (in seconds) between sending e-mails in case the critical level of free margin of equity is reached;
- Mail_Notify_Interval - minimum time interval (in seconds) between notifications sent via e-mail;
- Sound_Notify_Events - select what events you want to be notified of via sound notifications (0 - notifications disabled, 1 - notifying only of opening/closing positions, 2 - notifying of all events);
- Sound_Notify_Critical_Equity -critical value of (Equity) on the trade account (in deposit currency). When this value is reached, the sound notification is played;
- Sound_Notify_Critical_Margin - critical value of Free Margin comparing to Margin in percentage terms. When this value is reached, the sound notification is played;
- Sound_Repeat_Interval -minimum time interval (in seconds) between playing sound notifications in case the critical level of free margin of equity is reached;
- Sound_Notify_Interval - minimum time interval (in seconds) between sound alarm notifications;
- Sound_File_Name - name of the sound file played activated an event occurs;
- Use_Local_Time - time specified in messages sent to the mobile terminal or via email (false - trade server time, true - time of the PC the Expert Advisor is running at);
- Show_Information -show (true) or hide (false) information about the server time, local time and the settings and conditions of triggering of notifications.
Calculating Free Margin Level
As mentioned earlier, the Expert Advisor can notify of decreasing Free Margin compared to Margin. Let's examine calculation of Free Margin level in more details. In most cases (including MetaTrader 4 trading terminal), Margin value is defined considering Leverage provided by a broker. But the broker can change the leverage value at any time, and the Margin value also changes subsequently. Most often, the leverage value is not so critical for trading (unless trading is conducted in a risky manner using the maximum possible position volume). Therefore, this Expert Advisor calculates the Margin value without regard to the leverage. Free Margin level is defined as a ratio of Free Margin to Margin in percentage value.
Let's consider the following example. Suppose that 1 lot equals to 100 000 units of the base currency. Position at EURUSD is opened having the volume of 0.10 lots at the price of 1.3 USD per 1 EUR. For buying or selling 0.10 * 100 000 = 10 000 EUR we will need 13 000 USD. This value is considered to be the Margin for the present Expert Advisor (though in most cases a leverage is applied to that value, for example, if leverage is 1:100, then we will have 130 USD of Margin). If the deposit is equal to 1000 USD, Free Margin will be equal to 1000 - 130 = 870 USD after opening a position, while the Margin level will be calculated as 870 / 13 000 = 0.0669 or 6.69 %. If we set the Margin limit, at which notification is delivered, to 5%, the notification will be sent in case of Free Margin being equal to 0.05 * 13 000 = 650 USD or Equity comprising 650 + 130 = 780 USD.
Despite the apparent complexity of defining the Free Margin level, this method provided the most informative results in actual practice.
Sending Notifications to the Mobile Terminal
First of all, you should have mobile version of MetaTrader 4 or MetaTrader 5 terminal installed on your Android or iOS powered device to receive notifications. You can download MetaTrader 4 or MetaTrader 5 mobile terminal for Android, as well as MetaTrader 4 or MetaTrader 5 mobile terminal for iOS for free.
You should also allow sending push notifications in MetaTrader 4 trading terminal, on which the EA is to be launched. To do this, enter Tools – Options – Notifications tab, turn "Enable Push Notifications" parameter on and specify MetaQuotes_ID that can be found on Messages tab of the mobile terminal.
"Push_Notify_Events" parameter allows you to indicate the types of events you will be notified about via the mobile terminal. If it is set 2, you will be notified about the following events: opening and closing positions, changing stop loss and take profit of an open position, changing parameters of a pending order (open price, stop loss or take profit), change of the account balance or leverage. Value 1 means that the notifications will be send only when a position is opened or closed. Value 0 means that notifications via the mobile terminal are disabled (this parameter doesn't affect notification about critical free margin or equity).
"Push_Notify_Critical_Equity" parameter allows defining a critical (minimal) value of equity (in deposit currency). When this value is reached, the notification is sent to the mobile terminal. If set to 0, notifications of equity decrease are not sent to your mobile terminal.
"Push_Notify_Critical_Margin" parameter allows defining a critical (minimum) free margin level (in percentage value). When this value is reached, the notification is sent to the mobile terminal. If set to 0, notifications of free margin level are not sent to your mobile terminal.
Information about events on a trading account, as well as about reaching critical Equity or Free Margin levels is added to the message sent to the mobile terminal under certain conditions.
"Push_Repeat_Interval" parameter allows you to set the time interval (in seconds), after which information about reaching critical Equity or Free Margin level is added to the push message prepared for delivery.
"Push_Notify_Interva" input parameter allows you to set the minimum time interval (in seconds) between notifications sent to the mobile terminal. The Expert Advisor will not send a new notification if less than specified time has passed since sending the previous one. It will save that notification instead. When the time specified in "Push_Notify_Interval" parameter passes since sending the previous notification, the Expert Advisor will send a message containing descriptions of all events accumulated by that time. There is a limitation (of push notifications service developed by MetaQuotes) on the number of sent messages per unit time: no more than two messages per second and no more than 10 messages per minute (if this limitation is violated, sending push notifications can be blocked by MetaQuotes). Therefore, it is not recommended to set very small values (especially in case of the events' high frequency on a trading account).
" Push_Length_Limit" parameter allows you to set the maximum number of symbols in a message sent to the mobile terminal. If a message is longer, it is truncated down to the length specified in the parameter. The maximum permissible length of a push message is 255 characters. A message consists of two parts: account number with account owner's name (generated automatically) and a text description of an event generated by an Expert Advisor (its length is limited by "Push_Length_Limit" parameter). In some cases, a message may become invisible in the mobile terminal if its length exceeds 255 characters. "Push_Length_Limit" parameter value should be selected based on the length of the automatically added part of the message (account number and owner's name).
Sending Notifications Via E-Mail
To receive notifications via e-mail, you should allow sending emails in the settings of MetaTrader 4 trading terminal, at which NotifyMe Free for MT4 is launched. To do this, enter Tools – Options – Email tab, turn Enable parameter on and specify your e-mail account and SMTP e-mail server parameters.
Messages sent by the Expert Advisor via e-mail have subject "Account account_number notification".
"Mail_Notify_Events" parameter allows defining types of events followed by notifications via emails (similar to "Push_Notify_Level" parameter for notifications sent to the mobile terminal). If it is set 2, you will be notified about the following events: opening and closing positions, changing stop loss and take profit of an order, change of the account balance or leverage. Value 1 means that the notifications will be send only when a position is opened or closed. Value 0 means that notifications via e-mail are disabled (this parameter doesn't affect notifications about critical free margin or equity).
"Mail_Notify_Critical_Equity" parameter allows defining a critical (minimal) value of equity (in deposit currency). When this value is reached, the notification is sent via e-mail. If set to 0, notifications of equity decrease are not sent via e-mail.
"Mail_Notify_Critical_Margin" parameter allows defining a critical (minimum) free margin level (in percentage value). When this value is reached, the notification is sent via e-mail. If set to 0, notifications of margin decrease are not sent via e-mail.
Information about events on a trading account, as well as about reaching critical Equity or Free Margin levels is added to the message sent via e-mail under certain conditions.
"Mail_Repeat_Interval" parameter allows you to set the time interval (in seconds), after which information about reaching critical Equity or Free Margin level is added to the e-mail prepared for delivery.
"Mail_Notify_Interval" input parameter allows you to set the minimum time interval (in seconds) between notifications sent via e-mail. The Expert Advisor will not send a new notification if less than specified time has passed since sending the previous one. It will save that notification instead. When the time specified in "Mail_Notify_Interval" parameter passes since sending the previous notification, the Expert Advisor will send an e-mail containing descriptions of all events accumulated by that time. Some e-mail servers perceive frequent emails as harmful actions. Therefore, it is not recommended to set too small values for "Mail_Notify_Interval" parameter.
Audio Alarm Notifications
"Sound_Notify_Events" parameter allows you to define types of events followed by sound alarm notifications (similar to "Push_Notify_Events" parameter for notification sent to the mobile terminal and "Mail_Notify_Events" for notifications sent via e-mail). If it is set 2, you will be notified about all events (opening and closing positions, changing parameter of orders, change of the account balance or leverage). Value 1 means that the notifications will be send only when a position is opened or closed. Value 0 means that sound notifications are disabled (this parameter doesn't affect notifications about critical free margin or equity).
"Sound_Notify_Critical_Equity" input parameter allows you to define a critical (minimum) equity (in deposit currency) followed by sending sound alarm notifications. If set to 0, sound notifications of equity decrease are not triggered.
"Sound_Notify_Critical_Margin" input parameter allows you to define a critical (minimum) free margin level (in percentage terms) followed by sending sound alarm notifications. If set to 0, sound notifications of free margin decrease are not triggered.
" Sound_Repeat_Interval" parameter allows you to set the time interval (in seconds) between sound notifications about reaching critical Equity or Free Margin level.
"Sound_Notify_Interval" input parameter allows you to set the minimum time interval (in seconds) between sound notifications.
"Sound_File_Name" allows you to set the name of an audio file to be activated when a notification arrives. A file in .wav format should be located in terminal_folder/sounds or its subdirectory.
Displaying the Data on Screen
If Show_Information parameter is set to true, then the information about the server and local time will be displayed in the upper left corner of the chart as well as the settings and conditions of triggering of each notification type.
Examples of messages sent by the program
- Placing a pending order: 2013.08.12 14:56:13 EURUSD Place Sell Limit 0.10 at 1.32920, SL: 1.33000, TP: 1.32820, Comment: Test order;
- Changing pending order parameters: 2013.08.12 14:56:28 EURUSD Modify Sell Limit 0.10, Open: 1.32920 -> 1.32900, SL: 1.33000 -> 1.32980, TP: 1.32820 -> 1.32800;
- Deleting a pending order: 2013.08.12 14:56:34 EURUSD Delete Sell Limit 0.10 at 1.32900;
- Opening pending order: 2013.08.12 14.56.49 Sell Limit -> Sell at 1.32900, SL: 1.32980, TP: 1.32800, Comment: Test order;
- Opening market position: 2013.08.12 14:56:52 EURUSD Sell 0.10 at 1.32900, SL: 1.32980, TP: 1.32800, Magic: 17;
- Closing position: 2013.08.12 15:13:20 EURUSD Close Sell 0.10 at 1.32800, Magic: 17, (Profit: 10.00 USD), Balance: 1010.00 USD (Equity: 1010.00 USD);
- Reaching critical equity or free margin: 2013.08.12 15.32.16 Equity: 1004.30 USD, Free Margin: 868.47 USD;
Free Version and MetaTrader 5 Version
NotifyMe Free for MT4 - Free Version of the App Unlike the full version, it allows only sending notifications of position opening or closing. Also, full and free versions of the application with similar features are available for MetaTrader 5 trading terminal.
Warning
The developer of NotifyMe for MT4 is not responsible for possible modification or termination of the program's operation due to changes in MQL4 language implemented by the trading terminal and language developer - MetaQuotes company. The developer of NotifyMe for MT4 is not responsible for any loss, damage or missed profits caused by the use of the program, its work or malfunction.
Contact Information
If you have any questions about the application, comments on its operation or suggestions for future improvements, please send them by email or leave your personal messages via this web site. Let me know what products (Expert Advisors, indicators, scripts) you would like to see.
Works correctly. Please don't write directly to me about my review, I'll not answer.