News Day Blocker: Prevent Trading on High-Impact US Economic Events
Info
The News Day Blocker: Prevent Trading on High-Impact US Economic Events is a Expert Advisor for MetaTrader 5 that news day blocker automatically prevents new trades during significant us economic news releases, specifically us cpi (consumer price index) and fomc (federal open market committee) announcement days. The tool operates based on New York time, ensuring consistent behavior whether in live trading or backtesting.
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 News Day Blocker: Prevent Trading on High-Impact US Economic Events
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
News Day Blocker automatically prevents new trades during significant US economic news releases, specifically US CPI (Consumer Price Index) and FOMC (Federal Open Market Committee) announcement days.
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 Lines Utility: Economic Calendar On Your Chart - another powerful expert for MetaTrader 5 traders.
News Day Blocker automatically prevents new trades during significant US economic news releases, specifically US CPI (Consumer Price Index) and FOMC (Federal Open Market Committee) announcement days. The tool operates based on New York time, ensuring consistent behavior whether in live trading or backtesting. It is designed to never initiate new trades on these sensitive days.Also recommended: Calendar News Filter for MT5: Avoid Trading During High-Impact News Events - similar expert with strong performance on MetaTrader 5.
Functionality on News Days:
Closes any positions that were opened on the current day, with an option to filter by magic number to include trades from Expert Advisors (EAs) or manual trades.
Deletes pending orders that are currently active.
Closes any open positions at a user-defined New York time, for instance, at 08:25 AM, preceding the 08:30 AM CPI release. This feature is optional.
Sets a global terminal variable named NEWS_DAY_BLOCK to 1. On non-news days, this variable is set to 0. This allows custom EAs to check the variable and avoid trading by using a condition like: if(GlobalVariableGet("NEWS_DAY_BLOCK") == 1) return;.
Displays the current New York time, the trading status for the day, and the dates of upcoming CPI and FOMC events directly on the chart.
Included Files:
NewsDayBlocker.mq5: The main utility EA, to be placed in the Experts folder.
NyTime.mqh: A supporting include file for converting server time to New York time, accounting for US and EU daylight saving time. Place this file in the same folder as the main EA.
Input Parameters:
Broker server clock: Allows selection of the server's time zone relative to New York time. Options include New York + 7 hours, Central Europe, Eastern Europe, UTC, or automatic detection (for live trading only).
Action settings: Options to close positions opened on a news day, delete pending orders, and close open positions at a specified New York time. Set to -1 to disable these features.
Magic numbers: Specify magic numbers to filter trades. Leave empty to affect all trades, or set to 0 to only affect manual trades. Display status on the chart can be toggled.
Important Notes:
The economic event calendar is sourced from bls.gov and federalreserve.gov. The built-in calendar extends to December 2026. A warning will be issued 60 days prior to the calendar's expiration. Please note that official release dates are subject to change.
Extensive testing was conducted in the Strategy Tester from September to November 2026. During these tests, a trade position that was intentionally opened every day was exclusively closed on the five CPI/FOMC news days, confirming the tool's effectiveness.
You may also like: Strategy Tester News Filter with Corrected Calendar Export - 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"
#include <Trade/Trade.mqh>
#include "NyTime.mqh"
input ENUM_SERVER_CLOCK InpClock = CLOCK_NY7;
input bool InpCloseNew = true;
input bool InpDelPending = true;
input int InpCloseOpenNy = -1;
input string InpMagics = "";
.......
⚠ 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.