Header for global bank and currency exchange holidays
Header for global bank and currency exchange holidays. worldFxHoliday.mqh encapsulates a reusable holiday‐calendar module for MQL5, enabling scripts to load, store, and query currency‐specific holiday dates via an object‐oriented interface. ##### Core Responsibilities Defines the *HolidayEntry* class * Inherits from *CObject* to support cloning and integration with array/list containers * Encapsulates three fields: currency code (m\_currency), holiday name (m\_name), and exact date (m\_date) * Provides accessors (*Date(), Currency(), Name()*) for safe retrieval of entry data Implements the *CHolidays* manager class * Maintains an internal CList or *CArrayObj* of cloned *HolidayEntry* objects * Offers *LoadHolidays()* to populate the list from a static definition or external source, computing both fixed and dynamic holidays (e.g., nth weekday events) * Exposes *IsHoliday(datetime date, string currency)* to determine whether a given date is a holiday for a specified currency * Leverages MQL5’s built-in *StructToTime* and *TimeToStruct* (disambiguated where necessary) to convert between datetime and structured date representations Ensures modularity and future-proofing * Uses include guards (#ifndef…#define…) and clearly namespaced file naming * Integrates cleanly with other utility modules (ArrayObj, List, Object, StdLibErr) for dependency-driven extension ##### Typical Use Case 1. Include worldFxHoliday.mqh in an Expert Advisor or script. 2. Instantiate *CHolidays*, call *LoadHolidays()* at initialization. 3. On each tick or at critical decision points, invoke *IsHoliday(TimeCurrent(), "USD")* (or another currency) to determine if trading logic should respect market closures. |
||
---|---|---|
include |