Guide · Prop firms

Prop-firm news rules: how an EA should handle them

Some prop-firm accounts restrict trading around high-impact news. Here is what those rules usually say, how an EA can enforce them, and why your backtest needs a saved event list to match live trading.

Based on our team’s research and live testing since 2018.

High-impact releases such as central bank decisions, inflation data and employment reports can move prices sharply in seconds. Spreads widen, and fills can be far from the requested price. Some prop firms respond with a news rule: no trading in a short window around those events, at least on some account types.

A human trader can watch the calendar. An EA has to be told. This guide covers what news rules usually look like, how an EA enforces them, and the one detail that makes many news-filtered backtests wrong. Rules differ between firms and change often, so check your own firm’s current wording.

What does a prop-firm news rule usually say?

Most news rules have the same parts, even when the wording differs:

Part of the ruleTypical formsEA setting
Which eventsHigh-impact events only, sometimes from a list the firm publishesEvent list and importance filter
Which currencies or symbolsEvents for the currency of the instrument you tradeCurrency filter per symbol
WindowA few minutes before and after the releaseMinutes before, minutes after
What is restrictedOpening trades; at some firms also closing, modifying, or SL/TP fillsBlock entries; optional close-before
Which accountsSome programmes, or only funded accountsOn/off switch per account
ConsequenceFrom profits removed on those trades to a failed accountNo setting: avoid it

The most important line is “what is restricted”. If only new entries are restricted, blocking entries is enough. If any execution in the window counts, a stop loss or take profit that fills during the release can break the rule. In that case the EA must close or protect positions before the window opens.

How does an EA enforce a news window?

A news filter needs four things:

  1. An event list. Times of the high-impact events for the currencies you trade.
  2. A blackout window. Minutes before and after each event, set at least as wide as the firm’s.
  3. A position policy. Block new entries only, or also close open positions a set number of minutes before.
  4. The right clock. All times converted to one timezone, usually the broker’s server time.

On MT5 the event list can come from the built-in economic calendar. The MQL5 functions CalendarValueHistory and CalendarEventById return the scheduled events and their importance. According to the MQL5 reference book, calendar times are given in trade-server time, which is the same clock your EA’s TimeTradeServer() uses. MT4 has no calendar functions, so an MT4 EA needs the list from a file or another source.

Why do news-filtered backtests often go wrong?

The MT5 calendar functions do not work in the Strategy Tester. The MQL5 reference book states that calling them in the tester returns the error FUNCTION_NOT_ALLOWED (4014). An EA that only reads the live calendar therefore finds no events in a backtest, and trades straight through every release.

The result is a backtest that includes trades the live EA would never take, often the most volatile ones. The test and the live account no longer describe the same system. This is one of the quieter reasons an EA works in backtest but not live.

The fix is a saved event list. Export past high-impact events to a file while the terminal is connected, then let the EA read that file when it detects the Strategy Tester. The code below reads the live calendar normally and the saved file in the tester:

NewsFilter.mqh57 lines
1// NewsFilter.mqh: block trading around high-impact events (MT5)2input int    InpMinutesBefore = 5;                 // at least your firm's window3input int    InpMinutesAfter  = 5;4input string InpCurrencies    = "USD,EUR";5input string InpTesterFile    = "news_events.txt"; // Common\Files, for backtests6 7datetime g_events[];                               // event times, trade-server time8 9void AddEvent(datetime t)10{11   int k = ArraySize(g_events);12   ArrayResize(g_events, k + 1);13   g_events[k] = t;14}15 16// Live and demo: read the built-in calendar (times are trade-server time)17void LoadLiveEvents(datetime from, datetime to)18{19   ArrayResize(g_events, 0);20   string cur[];21   int n = StringSplit(InpCurrencies, ',', cur);22   for(int c = 0; c < n; c++)23   {24      MqlCalendarValue values[];25      if(CalendarValueHistory(values, from, to, NULL, cur[c]) <= 0) continue;26      for(int i = 0; i < ArraySize(values); i++)27      {28         MqlCalendarEvent ev;29         if(!CalendarEventById(values[i].event_id, ev)) continue;30         if(ev.importance == CALENDAR_IMPORTANCE_HIGH) AddEvent(values[i].time);31      }32   }33}34 35// Strategy Tester: calendar functions are not allowed, so read a saved list.36// One event per line, in trade-server time, e.g. 2026.10.02 15:3037void LoadTesterEvents()38{39   ArrayResize(g_events, 0);40   int h = FileOpen(InpTesterFile, FILE_READ | FILE_TXT | FILE_ANSI | FILE_COMMON);41   if(h == INVALID_HANDLE) { Print("News file not found: ", InpTesterFile); return; }42   while(!FileIsEnding(h))43   {44      string line = FileReadString(h);45      if(StringLen(line) >= 16) AddEvent(StringToTime(line));46   }47   FileClose(h);48}49 50bool InBlackout(datetime now)51{52   for(int i = 0; i < ArraySize(g_events); i++)53      if(now >= g_events[i] - InpMinutesBefore * 60 &&54         now <= g_events[i] + InpMinutesAfter  * 60)55         return true;56   return false;57}

And how the EA uses it:

Expert.mq5 (excerpt)19 lines
1int OnInit()2{3   if(MQLInfoInteger(MQL_TESTER)) LoadTesterEvents();4   else LoadLiveEvents(TimeTradeServer() - 86400, TimeTradeServer() + 7 * 86400);5   EventSetTimer(3600);                     // refresh the live list every hour6   return INIT_SUCCEEDED;7}8 9void OnTimer()10{11   if(!MQLInfoInteger(MQL_TESTER))12      LoadLiveEvents(TimeTradeServer() - 86400, TimeTradeServer() + 7 * 86400);13}14 15void OnTick()16{17   if(InBlackout(TimeTradeServer())) return;   // no new entries in the window18   // ... normal entry logic ...19}

Two notes on this code. The file is read from the terminals’ common data folder (FILE_COMMON); you can also send a file to testing agents with #property tester_file. And the tester file must be in the same server time as the price history, including daylight-saving changes. The MQL5 book warns that historical event times need adjusting for daylight-saving periods that differ from the current one. Check a few known events against the chart before you trust a backtest.

Which timezone should the EA use?

Three clocks are involved: the firm’s (often stated in its own timezone or UTC), the broker’s server time, and your own local time. They rarely match, and daylight-saving changes happen on different dates in different countries.

Pick one clock for the EA, normally broker server time, and convert everything into it. If the firm publishes its event list in another timezone, convert the list once and check it against a known release. A filter that is one hour wrong for two weeks a year will fail on exactly the days it matters.

Should the EA close positions before the news?

That depends on two things: the firm’s rule and your strategy.

  • If the firm restricts any execution in the window, an open position with a stop loss near the price is a risk. Close it, or move the stop and target outside likely reach, before the window starts.
  • If only new entries are restricted, holding may be allowed. You still carry the slippage risk on your stop during the release.
  • Swing strategies that hold for days may prefer to hold and accept the risk. Intraday strategies usually do better closing early.

Make it an input (“close N minutes before”, on or off), and backtest both settings. Use the prop-firm drawdown calculator to see how much a gap on the release could cost relative to your remaining daily room.

A worked example

Illustrative numbers. Your firm restricts trading 2 minutes before and after high-impact USD events on your funded account, and SL/TP fills in the window count. A US release is scheduled at 15:30 server time.

  • Set the EA window to 5 minutes before and 5 after, wider than the firm’s 2, to absorb clock differences.
  • Set close-before to 10 minutes, so positions on USD pairs are flat by 15:20.
  • The EA blocks new entries from 15:25 until 15:35.
  • In the backtest, the saved event list makes the EA skip the same windows.

Checklist

  • Read your firm’s news rule for your exact account type
  • Know what is restricted: entries only, or any execution
  • Window at least as wide as the firm’s, as an input
  • All event times in broker server time, daylight saving checked
  • Saved event list for the Strategy Tester
  • Close-before option tested both ways

The news rule is one of several. The full set, including daily loss and drawdown, is in how to make an EA prop-firm compliant. If you would like a filter like this built into your EA, see prop-firm EA development.

General information about software design, not financial advice. Prop firms set and change their own rules; your firm’s current terms take precedence. The example uses illustrative numbers.

Quick answers

Do all prop firms have a news rule?

No. Some have none, some apply it only to funded accounts, and some only to certain programmes. Check the rules for your exact account type.

Does a stop loss hit during news count as trading the news?

At some firms, yes: any order executed in the window can count, including a stop loss or take profit. If your firm works this way, close or adjust positions before the window opens.

Can MT4 read the economic calendar?

Not built in. MQL4 has no calendar functions, so an MT4 EA needs an event list from a file or another source.

Which news calendar does my firm use?

Firms name their own source or publish their own list. Use the firm’s list as the authority, and set your EA’s window at least as wide as the firm’s.

Is a wider window always safer?

It is safer for the rule, but it removes more trades. Backtest with the window you plan to use, so the results reflect the trades you will actually skip.

Written by
Rohit B., Vertex Algorithms

Co-founder and lead developer. Building MT4/MT5 Expert Advisors, Python trading bots and Pine Script since 2018, with trading analysis by co-founders Harshal K. and Bilal M. About the founders →

Need a news filter in your EA?

I add news filters to new and existing MT4/MT5 EAs: your firm’s window, your currencies, a close-before option, and a saved event list so the backtest matches live trading.

WhatsApp