Discussing the article: "Building a Prop Firm Compliance Monitor in MQL5 (Part 4): Economic Calendar and Account Exposure Monitoring"

Check out the new article: Building a Prop Firm Compliance Monitor in MQL5 (Part 4): Economic Calendar and Account Exposure Monitoring.

This article explains exposure-aware economic news monitoring for Prop Firm Guard in MetaTrader 5. The EA builds a unique currency set from supported open positions, treats XAUUSD as USD exposure, filters Economic Calendar events by currency, minimum importance, specific scheduled datetime, and search horizon, and selects the nearest qualifying event. The resulting countdown and restriction window are integrated into the EA through OnInit() and OnTimer().

Some prop-firm programs restrict how traders manage open positions around important economic releases. For Prop Firm Guard, the problem is not simply reading MetaTrader 5's Economic Calendar. The EA first needs to determine which events are relevant to the account's current holdings.

Checking only the chart's _Symbol is not enough because the account may hold positions on several instruments. Part 4 therefore scans all open positions, derives the supported exposed currencies, removes duplicates, and uses that set to filter the calendar. For example, EURUSD and GBPUSD produce EUR, USD, and GBP exposure. For the explicit XAU/USD case used in this implementation, USD is monitored when the broker reports XAU as the base currency and USD as the profit currency.

This Part is limited to holding-based news monitoring. If there are no supported open positions, the EA can report no supported holding exposure, but that does not mean a new trade would necessarily be allowed.

By the end of Part 4, Prop Firm Guard will distinguish no supported holding exposure, no qualifying event, unavailable data, a safe upcoming event, and an active news restriction. A manual verification matrix near the end of this article provides repeatable scenarios for checking these states. The tests use the account-level variable g_newsState.status, which can be inspected in the MetaEditor debugger immediately after UpdateNewsState() executes in OnTimer(). Because exposure is collected across the account, the chart symbol does not determine which positions are monitored.

Before collecting position exposure or querying the Economic Calendar, Part 4 needs clear result states. In particular, the EA must not treat an empty search as a data failure, or an unsupported instrument as an unreadable one. These distinctions begin with the news-related enumerations. Place the following news-status enumeration immediately after ENUM_GUARD_STATUS:

Author: Chacha Ian Maroa