Economic News Pausing Utility for Expert Advisors
Info
The Economic News Pausing Utility for Expert Advisors is a Expert Advisor for MetaTrader 5 that this expert advisor does not trade. It monitors the economic calendar of the terminal every 30 seconds for events of selected importance related to watched currencies.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Economic News Pausing Utility for Expert Advisors
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
This Expert Advisor does not trade.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.
Description & Settings
Related: News Guard: EA News Filter and Slippage Logger - another powerful expert for MetaTrader 5 traders.
This Expert Advisor does not trade. It monitors the economic calendar of the terminal every 30 seconds for events of selected importance related to watched currencies.Also recommended: News Straddle EA for Economic Calendar Events - similar expert with strong performance on MetaTrader 5.
From a specified number of minutes before an event until a specified number of minutes after it, the terminal global variable NEWS_PAUSE is set to 1; at other times it is 0.
Any other Expert Advisor in the same terminal can read this flag using GlobalVariableGet and skip new entries while the flag is 1. The chart comment displays the flag's status, the active event, and the next relevant event with the remaining time. Changes in the flag's state are also logged in the Experts log.
Figure 1. The utility on a EURUSD H1 chart displaying the next event.
Input Parameters
InpMinImportance
- Sets the minimum importance of events to monitor: 1 for low, 2 for moderate, 3 for high.
InpCurrencies
- A comma-separated list of currencies to watch events for (e.g., USD,EUR,GBP,JPY).
InpMinutesBefore
- Defines how many minutes prior to an event the monitoring window begins.
InpMinutesAfter
- Defines how many minutes after an event the monitoring window ends.
InpFlagName
- Specifies the name of the terminal global variable used to store the flag.
InpLookAheadHrs
- Sets the number of hours ahead to search for the next event displayed on the chart.
Notes
A simple check within another Expert Advisor can be implemented as: if(GlobalVariableCheck("NEWS_PAUSE") && GlobalVariableGet("NEWS_PAUSE")==1.0) return; placed before the entry logic. The flag is automatically reset to 0 when the utility is removed from the chart.
Event names are displayed using their calendar codes, ensuring language independence. The economic calendar is unavailable in the Strategy Tester; in the tester, the utility will display a message and maintain the flag at 0.
You may also like: News Day Blocker: Prevent Trading on High-Impact US Economic Events - excellent alternative for expert users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
input int InpMinImportance = 3;
input string InpCurrencies = "USD,EUR,GBP,JPY";
input int InpMinutesBefore = 30;
input int InpMinutesAfter = 15;
input string InpFlagName = "NEWS_PAUSE";
input int InpLookAheadHrs = 48;
string ExtCurrencies[];
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.