The package builds a news feed from CalendarValueHistory(): it filters by impact and currency, maps events to a symbol universe, and stores them in a time‑sorted array with minutes to event. You can query GetNextEvent() and IsInNewsWindow() to implement deterministic news filtering in an EA. An abstract source and clock, plus terminal and fake implementations, enable testing when calendar functions are unavailable in the Strategy Tester.
An Expert Advisor that wants to avoid trading around scheduled news has to read the terminal calendar first. The built-in CalendarValueHistory() function returns raw records for every country and every importance level in the requested range. Before an EA can use them for news filtering, the records need an impact filter, a currency filter, a mapping to the symbols that the EA trades, a sort order, and a clear answer to one question: how far away is the next event right now?
This article presents a small package that does this work. The central class is CCalendarFeed. It wraps CalendarValueHistory(), keeps only the events that matter for the universe, stores them in a time-sorted array of CCalendarEvent structures, and answers two queries: GetNextEvent() and IsInNewsWindow().
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Aggregating Economic Calendar Events into a Structured MQL5 Data Feed.
An Expert Advisor that wants to avoid trading around scheduled news has to read the terminal calendar first. The built-in CalendarValueHistory() function returns raw records for every country and every importance level in the requested range. Before an EA can use them for news filtering, the records need an impact filter, a currency filter, a mapping to the symbols that the EA trades, a sort order, and a clear answer to one question: how far away is the next event right now?
This article presents a small package that does this work. The central class is CCalendarFeed. It wraps CalendarValueHistory(), keeps only the events that matter for the universe, stores them in a time-sorted array of CCalendarEvent structures, and answers two queries: GetNextEvent() and IsInNewsWindow().
Author: Ushana Kevin Iorkumbul