I was on a train last month when one of my EAs triggered a major entry signal. By the time I got home, the move was over. That's when I realized: I needed the EA to ping my phone the moment something happened.
The MetaTrader 5 mobile app supports something called push notifications—short text messages that get sent to your mobile device regardless of whether the app is running . The only requirement is an internet connection on your phone. After setting this up, I now get alerts on my lock screen within seconds of an EA event.
Step 1: Find Your MetaQuotes ID
When you install MT5 on your phone, the app assigns you a unique identifier called the MetaQuotes ID. Think of it like a phone number for receiving trading alerts .
To find yours:
Before you can receive notifications, make sure you've enabled push notifications in your phone's system settings: Settings > Notifications > MetaTrader 5 > Enable "Allow Notifications" .
Step 2: Configure the Desktop Terminal to Send Notifications
Now, go to your desktop MT5 terminal. This part is not well-documented for beginners, but it's straightforward once you know where to look.
Navigate to Tools > Options > Notifications tab . Here's what you need to do:
- Local terminal notifications: The desktop MT5 sends the alert. This means your desktop MT5 needs to be running for the notification to go out.
- Trading server notifications: This is the better option in my opinion—the notification comes directly from your broker's server, so even if your desktop terminal is off, you'll still get the alert when a stop loss is hit or an order fills .
Step 3: Send EA Alerts Using the
SendNotification FunctionThe real power comes from integrating this into your EAs. The MQL5 documentation provides the
SendNotification() function, which allows your Expert Advisor to send a push notification to the MetaQuotes ID specified in the terminal settings .Here's a snippet I use in my EA to ping my phone when a position is opened:
``
mql5
void SendOpenAlert(string symbol, double price, string orderType)
{
string message = StringFormat(
"Position opened: %s %s at %.5f",
symbol, orderType, price
);
bool sent = SendNotification(message);
if(!sent)
Print("Notification failed: ", GetLastError());
}
`
The function returns true` if the message is successfully queued. One thing to watch out for: there's a rate limit. According to the official MetaQuotes documentation, you cannot send more than 1 message per 0.5 seconds and no more than 10 messages per minute . If your EA is spammy, the messages will get blocked.A hidden tip from experience
If you're also using the MQL5 community features, you can enter your MetaQuotes ID in your MQL5 profile settings. This will send you notifications about comments on your articles, new messages in the forum, and updates about your products in the Market. I didn't know this existed until I started publishing scripts there—it's a huge time-saver for staying active in the community .
Reference: MetaTrader 5 Help - Push Notifications (metatrader5.com) .
This article was originally published on FXEAR.com. All rights reserved. Unauthorized reproduction is prohibited.