News filter in an EA, using a calendar file vs just blocking fixed times
my EA used to trade through everything and the worst fills were all around red folder news. I added a news filter, and I tried two ways of doing it.
The first was a simple list of times: no new trades for X minutes before and after specific times, like the 13:30 GMT US data. It works for the recurring ones, but it misses unscheduled changes and anything that moves around, like central bank speakers.
The second was reading a calendar file, which I update weekly, with the date, time, currency and impact for each event. The EA checks if the pair involves that currency and the impact is high and then it blocks trading for a window around it. It's more work to maintain but way more complete.
Both are only as good as the data. I noticed times in some free calendars were wrong by an hour around daylight saving changes, so I verify the week's events manually. I also close or move to breakeven open trades before the event instead of leaving them exposed.
News filter in an EA, using a calendar file vs just blocking fixed times
Re: News filter in an EA, using a calendar file vs just blocking fixed times
For anyone building the calendar file approach, I keep it as a plain CSV with one event per line: date, time in GMT, currency and impact. I update it every Sunday from a calendar I trust and double check the times. The EA reads the file when it starts and again once a day. Keeping the file simple means I can edit it in a text editor in a couple of minutes, and if something unscheduled is announced midweek I can add a line and the EA picks it up.
It’s Fairman 
Re: News filter in an EA, using a calendar file vs just blocking fixed times
On the window size, I started with thirty minutes either side of every high impact event and found that was too much on some days and not enough on others. Now I use a longer window for the big ones like rate decisions and payrolls, and a shorter one for second tier data. It is a bit more work to set up, but the EA trades more on quiet news days and stays out longer on the really dangerous ones.
It’s Fairman 
-
Shadow Trader
- Posts: 2154
- Joined: Wed Sep 09, 2026 5:19 pm
Re: News filter in an EA, using a calendar file vs just blocking fixed times
A GMT time in the fixed list is only right for part of the year. The 8:30 New York releases land at 12:30 GMT during US summer time, which ends on 1 November, and at 13:30 GMT from then until March.
Many broker servers add another layer by running a clock that shifts with New York, so the offset to a GMT calendar moves twice a year. Europe and the US also switch on different weekends, which leaves a few weeks each spring and autumn where one of the two is out by an hour.
Symbol names are a smaller trap. If the EA reads the currencies from the first and last three letters, a suffix like EURUSD.m breaks the match, and gold needs USD events mapped by hand.
For the calendar file, it is worth deciding what happens when the file is missing or stale. A rule such as no new trades if the newest event is over eight days old turns a forgotten Sunday update into a quiet day rather than an unfiltered one.
An uneven window often fits better than a symmetric one, say five minutes before and twenty after. Spreads recover fast, while the second leg of the move can take a while.
Many broker servers add another layer by running a clock that shifts with New York, so the offset to a GMT calendar moves twice a year. Europe and the US also switch on different weekends, which leaves a few weeks each spring and autumn where one of the two is out by an hour.
Symbol names are a smaller trap. If the EA reads the currencies from the first and last three letters, a suffix like EURUSD.m breaks the match, and gold needs USD events mapped by hand.
For the calendar file, it is worth deciding what happens when the file is missing or stale. A rule such as no new trades if the newest event is over eight days old turns a forgotten Sunday update into a quiet day rather than an unfiltered one.
An uneven window often fits better than a symmetric one, say five minutes before and twenty after. Spreads recover fast, while the second leg of the move can take a while.
-
Shadow Trader
- Posts: 2154
- Joined: Wed Sep 09, 2026 5:19 pm
Re: News filter in an EA, using a calendar file vs just blocking fixed times
A spread guard makes a useful second layer behind either method. If the EA refuses new entries whenever the spread is above, say, twice its median for that hour, it catches the unscheduled shocks the calendar never listed, like a surprise headline or a speaker who goes off script.
The median needs to be per hour rather than one number, because 0.3 pips mid morning and 1.2 pips at rollover are both normal. A single fixed limit either blocks the whole Asian session or misses the London spikes.
For backtesting the calendar version, one practical snag in MetaTrader is where the file lives. The strategy tester runs in its own sandbox and does not see the terminal's usual Files folder, so opening the CSV with the common flag and keeping it in the shared Common folder lets the live EA and the tester read the same file.
The backtest is only honest if the file holds events as they were scheduled at the time. A calendar downloaded today may have corrected times or dropped cancelled events, which flatters the filter slightly.
Has anyone measured how many trades the filter removes in a typical month? If it is more than a fifth, the window may be cutting into the edge.
The median needs to be per hour rather than one number, because 0.3 pips mid morning and 1.2 pips at rollover are both normal. A single fixed limit either blocks the whole Asian session or misses the London spikes.
For backtesting the calendar version, one practical snag in MetaTrader is where the file lives. The strategy tester runs in its own sandbox and does not see the terminal's usual Files folder, so opening the CSV with the common flag and keeping it in the shared Common folder lets the live EA and the tester read the same file.
The backtest is only honest if the file holds events as they were scheduled at the time. A calendar downloaded today may have corrected times or dropped cancelled events, which flatters the filter slightly.
Has anyone measured how many trades the filter removes in a typical month? If it is more than a fifth, the window may be cutting into the edge.
-
FXS Prop Desk
- Posts: 1009
- Joined: Wed Oct 07, 2026 9:52 am
Re: News filter in an EA, using a calendar file vs just blocking fixed times
The unscheduled events are the real weakness of the fixed time list. Another approach is to add a spread filter on top of the news filter: no new trades when the spread is above a set multiple of normal. That catches unscheduled news too, because spreads widen almost immediately when something unexpected happens.
The combination of a calendar file for planned events and a spread check for everything else covers most situations. Neither is perfect alone, but together they block most of the bad fills.
The combination of a calendar file for planned events and a spread check for everything else covers most situations. Neither is perfect alone, but together they block most of the bad fills.
FXS Official Team | The Idea Lab & Strategy