//+------------------------------------------------------------------+ //| EventCodeToId.mq5 | //| Copyright 2026, Niquel Mendoza. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Niquel Mendoza." #property link "https://www.mql5.com" #property version "1.00" #property strict #property script_show_inputs //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #include //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ input string InpStr = "producer-price-index-mm"; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- if(InpStr[0] == '#') { MqlCalendarEvent event[1]; const ulong id = ulong(InpStr.Substr(1, StringLen(InpStr))); CalendarEventById(id, event[0]); ArrayPrint(event); MqlCalendarValue values[]; Print(CalendarValueHistoryByEvent(id, values, 0)); return; } //--- ulong events_id[]; const int t = TSN::CalendarByLeo_ParseStrEvents(CALENDAR_COUNTRY_CODE_HASH_US, InpStr, ',', events_id); for(int i = 0; i < t; i++) { MqlCalendarEvent event; CalendarEventById(events_id[i], event); Print("code: ", event.event_code, " id: ", events_id[i]); } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+