Economic Calendar for MetaTrader 4: an Indicator and an Expert Advisor That Protects Your Orders Before the News

Short answer: unlike MT5, MetaTrader 4 has no economic calendar of its own. Two products close the gap. The Economic Calendar indicator draws the news on your charts and carries the whole event base since 2007 inside the file, so it also works in the Strategy Tester. The Calendar Feed Expert Advisor brings live data, sends alerts to your phone and, if you enable it, closes orders and pauses other EAs shortly before a release. Each works on its own, and together they give more.

Why a calendar matters

Technical analysis alone does not make trading safe. Important news comes out while you are asleep, at lunch or looking at another chart, and within seconds a calm position becomes a problem: the spread widens, price jumps over your stops and slippage eats part of the deposit. Knowing that a release is coming is not enough, you also have to manage to do something about it.

There is the same issue in testing. A strategy tested mostly on quiet days looks better than it will in life. To judge it honestly you need to see how it went through every big release.

The indicator: the calendar on the chart and in the tester

The main advantage over other calendars: the event base since 2007 is built into the file. The indicator needs no internet, no WebRequest and no subscription, and it runs in the Strategy Tester, so you can check how your EA lived through every important release in almost twenty years. Currencies are taken from the symbol (EURUSD gives EUR and USD), or you can set your own list.

What you see:

GBPUSD H4: vertical event lines with titles, news histograms and the info panel

The base is updated every month through Market, as with any product, and the indicator warns you when the data is close to the end.

The indicator for your EAs: the buffers

The indicator hands data to Expert Advisors through buffers. Thanks to the built-in base this works in the tester too.

GBPUSD M15: windows around the releases and the holiday strip

# Buffer What it holds
0 Holiday holidays
1 Low low-impact events
2 Medium medium-impact events
3 High high-impact events
4 Trade stop 0 free, 1 inside a news window, 2 day closed
5 Min to next minutes to the next event
6 Min since last minutes since the last event

The most useful one is buffer 4, "Trade stop". By default a window for high-impact news is 1 hour before and 2 hours after, for medium 30 minutes before and 1 hour after. A day can be closed completely, for example on a rate decision or Non-Farm Payrolls, and the list of such events is configurable. A few lines are enough for an EA:

// no new trades near the news or on a closed day
double stop = iCustom(Symbol(), Period(), "EconCalendar", 4, 0);
if(stop != EMPTY_VALUE && stop >= 1.0) return;

// the news is 15 minutes away or closer: remove the orders
double toNext = iCustom(Symbol(), Period(), "EconCalendar", 5, 0);
if(toNext != EMPTY_VALUE && toNext <= 15) CloseAllMyOrders();

Check EMPTY_VALUE explicitly: in MQL4 it equals 2147483647, not zero. The full list of parameters and the details of each buffer are in the full guide on MQL5.

The Expert Advisor: panel, alerts and Guard

The Calendar Feed Expert Advisor does not trade the news. It is a panel, an alert system and a guard: it watches the schedule while you are busy and either tells you in time or takes your orders out of the market. It works on its own, the indicator is not required.

The panel takes the whole height of the chart and can be dragged and collapsed. It has the tabs Feed, Alerts, Guard, Log and Settings.

Feed. The nearest events with filters by currency and impact, in your time zone, the broker's or UTC. The actual value appears seconds after the release.

The Feed tab: the next event with a countdown and the list of events with forecast and previous values

Alerts. Channels: a push to your phone (MetaQuotes ID), e-mail, a Telegram bot, a terminal window and sound. You get two reminders N minutes before the news, a message with the actual figure, a "Surprise" tag when the actual value differs strongly from the forecast, and a warning if the data feed has gone silent. Every reminder is sent once and is not repeated after a terminal restart.

The Alerts tab: channels, two reminders, the actual value, the surprise tag and the silent-feed warning

Guard. Here you choose a block of important news from the list and turn on, for it:

The Guard tab: closing orders and stopping advisors before the news, filters by symbol, magic number and ticket

Every closed or deleted order comes as a separate notification, so does every switch of Algo Trading and every closing error. If the market is closed or the server is busy, the EA keeps trying until the news. By default Guard does nothing: every block is turned on by you by hand.

Live data

The calendar updates over the network every few minutes (the interval is a setting). You have to allow the address from the FeedUrl parameter once in Tools - Options - Expert Advisors - "Allow WebRequest for listed URL" (and api.telegram.org for Telegram). If the connection is lost, the EA tells you, and the data stays as it was.

Better together

With the Expert Advisor running, the indicator gets live actual, forecast and previous values right after the release, and revised or moved events are updated. One Expert Advisor on any single chart is enough for all the indicators of the terminal, nothing has to be configured for the link. The indicator saves what it receives to a file, so nothing is lost after a restart.

What to keep in mind

Where to get them

Both products are on MQL5 Market, 49.99 USD each, and both have a free demo: the Economic Calendar indicator and the Calendar Feed Expert Advisor. The other products are on the Products page.

Was this article helpful?

The answer is anonymous: we do not store your name, email or IP address.

Economic Calendar indicator for MT4 Calendar Feed Expert Advisor for MT4 All products
Back to Blog