Introduction
Every experienced MetaTrader user knows the frustration: you step away for five minutes and miss a critical price level, a pending order fill, or an indicator signal that could have made your day. The platform's built-in alert system is your solution. By the end of this guide, you will be able to configure email, push, and sound alerts in both MT4 and MT5, attach them to indicators and Expert Advisors (EAs), and set up mobile push notifications so you never miss an important market event again. This is not about trading strategies—it is about mastering the notification toolchain that keeps you connected to your charts 24/7.
Prerequisites
- MetaTrader 4 or 5 (build 1090 or newer recommended for push notifications). Both platforms support the same alert methods, though menu paths differ slightly.
- A funded live or demo trading account connected to your terminal. Alerts work on any account type.
- For push notifications: The official MetaTrader mobile app installed on your smartphone (iOS or Android) and signed in with the same account.
- For email alerts: A valid email account (Gmail, Outlook, or any SMTP-enabled provider) and your email server settings.
- Basic familiarity with the MetaEditor (F4) if you plan to add custom alert code to indicators or EAs.
Step-by-Step Instructions: Setting Up Alerts in MetaTrader 4/5
1. Configuring Email Alerts
Email alerts send messages directly to your inbox when triggered. This is reliable for non-urgent notifications (daily summaries, end-of-day reports) but introduces a delay of several seconds due to SMTP handshaking.
- Open MetaTrader and go to Tools > Options (or press Ctrl+O).
- Click the Email tab.
- Check Enable (MT4) or Allow sending emails (MT5).
- Enter your SMTP server details. For Gmail, use:
- SMTP server:
smtp.gmail.com - Port:
587 - Security: TLS (check "Use secure connection" if available)
- Login: your full Gmail address (e.g.,
[email protected]) - Password: your Gmail app password (not your regular password—generate one in Google Account settings under "App passwords")
- SMTP server:
- Enter the From field (same as login) and To field (your receiving email address).
- Click Test. You should receive a test email within 10-15 seconds. If not, double-check the port and security settings.
- Click OK to save.
MT4 vs MT5 difference: MT4's Email tab also has a "Subject" field you can customize. MT5 omits this—the subject is auto-generated.
2. Configuring Push Notifications
Push notifications are instant, free, and work even when the terminal is minimized. They are the gold standard for real-time alerts.
- Install the MetaTrader mobile app on your smartphone and log in with the same account number and password as your desktop terminal.
- On the desktop terminal, go to Tools > Options > Notifications tab.
- Check Enable push notifications.
- In the Token field, enter the unique token shown in your mobile app: open the app, tap the three-dot menu (or Settings icon), select Notifications, and you will see a long alphanumeric string labeled "MetaQuotes ID" or "Token". Copy it exactly.
- Optionally, check Notify about trade operations to receive alerts on every order execution.
- Click OK. The terminal will send a test notification to your phone within a few seconds.
Important: The token is tied to your mobile device and account. If you reinstall the app or change accounts, you must generate a new token and update it in the terminal.
3. Adding Sound Alerts to Indicators and EAs
Sound alerts play a WAV file from the terminal's Sounds folder. They are useful when you are at your desk but not staring at the screen.
- Place your custom WAV file (e.g.,
alert.wav) in theMetaTrader 4\Sounds\orMetaTrader 5\Sounds\directory. - In an indicator or EA, use the MQL4/MQL5 function:
PlaySound("alert.wav"); - For built-in indicators (like Moving Average crossover), right-click the chart, select Expert Advisors > Add Alert (MT5) or use the Alerts window from the View menu (MT4). Configure the trigger condition and select "Sound" as the action.
4. Creating Custom Alerts in MQL4/MQL5 Code
For full control, add alert logic directly to your custom indicators or EAs. Here is a minimal example that sends a push notification when price crosses a moving average:
// MQL4/MQL5 example
void OnTick()
{
double ma = iMA(_Symbol, _Period, 14, 0, MODE_SMA, PRICE_CLOSE, 0);
double prevMa = iMA(_Symbol, _Period, 14, 0, MODE_SMA, PRICE_CLOSE, 1);
double close = Close[0];
double prevClose = Close[1];
if (prevClose <= prevMa && close > ma)
{
SendNotification("BUY signal on " + _Symbol + " at " + DoubleToString(close, _Digits));
PlaySound("alert.wav");
}
else if (prevClose >= prevMa && close < ma)
{
SendNotification("SELL signal on " + _Symbol + " at " + DoubleToString(close, _Digits));
PlaySound("alert.wav");
}
}
Compile (F7) and attach to a chart. Ensure Allow DLL imports is unchecked (not needed) and Allow algorithmic trading is checked.
5. Using the Built-in Alert Object
You can also add an alert object directly on a chart without coding:
- Right-click the chart, choose Insert > Objects > Alert (MT4) or Insert > Object > Alert (MT5).
- Click on the chart to place the alert line (a horizontal line with a label).
- Double-click the line to open properties. Set the Price, Expiration, and Action (Sound, Email, Push, or File).
- Choose Repeat if you want the alert to fire every time price touches the line (not just once).
Tips and Best Practices from Experience
- Use push notifications for urgent signals. Email alerts can lag by 5-15 seconds due to SMTP delays. Push notifications arrive in under a second.
- Test each alert method individually. After configuring email, send a test. After push, trigger a manual test from the terminal. Never assume it works—I once missed a trade because my SMTP password expired.
- Keep sound files short. WAV files larger than 1 MB can cause the terminal to stutter. Use 16-bit mono WAV at 22 kHz for crisp, small files.
- Set a unique alert for each condition. If your EA triggers both a buy and sell alert with the same sound, you won't know which one fired. Use different sounds or include the symbol/timeframe in the notification text.
- Use the Alert() function for on-screen popups.
Alert("Text")displays a modal dialog. It is useful for debugging but annoying in live trading—use sparingly. - Store tokens securely. Do not share your MetaQuotes ID; anyone with it can send notifications to your phone.
Common Mistakes and Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Email test fails | Wrong port, TLS disabled, or using regular password instead of app password | Use port 587 with TLS. Generate an app password from your email provider's security settings. |
| Push notification not received | Token entered incorrectly, or mobile app logged into a different account | Re-copy the token from the mobile app. Ensure the same account number is used on both devices. |
| Sound alert does not play | File not in Sounds folder, or wrong filename (case-sensitive on some systems) | Place the WAV file in MQL4\Files\ or MQL5\Files\ for MQL code; for chart alerts, use the Sounds\ folder. Use lowercase filenames. |
| Alert fires repeatedly | No debounce logic in MQL code, or chart alert set to repeat | Add a static boolean flag to fire once per bar. For chart alerts, uncheck "Repeat" or set a reasonable expiration. |
Summary / Recap and Next Steps
You now have a complete toolkit for setting up MetaTrader alerts: email for non-critical reports, push notifications for instant mobile alerts, sound alerts for desk-based monitoring, and custom MQL code for tailored triggers. Start by configuring push notifications—they are the most reliable method. Then add email as a backup. Finally, experiment with custom alerts in your own EAs and indicators using the SendNotification() and PlaySound() functions.
As a next step, explore the Alerts window (View > Alerts) in MT4 to manage all active alerts from a single dashboard. In MT5, use the Toolbox > Alerts tab. You can also combine multiple conditions—for example, send a push notification only when price crosses a moving average and volume exceeds a threshold. The MQL language gives you limitless flexibility once you master these basics.
Frequently Asked Questions
Can I receive push notifications on multiple phones for the same MetaTrader account?
No. Each MetaTrader account can only have one active push notification token at a time. To receive alerts on multiple devices, you would need to use email alerts forwarded to multiple addresses, or set up a custom solution that forwards push notifications via a third-party service.
Why does my email alert work in the test but not when triggered by an EA?
The test sends a static message, but EA-triggered emails depend on the EA being attached to a chart and running. Make sure the EA is enabled (right-click chart > Expert Advisors > Properties > Common tab > check "Allow live trading"). Also verify that the terminal's AutoTrading button is green.
Can I use variables like symbol and price in alert text without coding?
Only partially. The built-in chart alert object supports limited placeholders like {Symbol} and {Price} in the comment field. For full customization (e.g., "BUY EURUSD at 1.1050"), you must write a few lines of MQL code as shown above.
How do I stop an EA from sending too many alerts in one minute?
Add a time-based throttle. For example, track the last alert time using a static datetime variable and only fire if at least 60 seconds have passed. This prevents notification spam during volatile markets.






