CalendarEventById

Abrufen der Ereignisbeschreibung nach seiner ID.

bool  CalendarEventById(
   ulong                event_id,     // Ereignis-ID
   MqlCalendarEvent&    event         // Variable zur Übernahme einer Ereignisbeschreibung
   );

Parameter

event_id

[in]  Ereignis-ID.

event

[out]   Variable vom Typ MqlCalendarEvent für die Übernahme der Ereignisbeschreibung.

Rückgabewert

Liefert bei Erfolg true, ansonsten false. Um Informationen über einen Fehler zu erhalten, rufen Sie die Funktion GetLastError() auf. Mögliche Fehler:

  • 4001 - ERR_INTERNAL_ERROR  (allgemeiner Laufzeitfehler),
  • 5402 – ERR_CALENDAR_NO_DATA (Land wurde nicht gefunden),
  • 5401 - ERR_CALENDAR_TIMEOUT (Zeitlimit für Anfragen überschritten).

Beispiel:

//+------------------------------------------------------------------+
//| Skript Programm Start Funktion                                   |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- Länder-Code für Deutschland (ISO 3166-1 Alpha-2)
   string germany_code="DE";
//--- Abrufen der Ereignisse Deutschlands
   MqlCalendarEvent events[];
   int events_count=CalendarEventByCountry(germany_code,events);
//--- Anzeige der Ereignisse Deutschlands im Journal
   if(events_count>0)
     {
      PrintFormat("Ereignisse Deutschlands: %d",events_count);
      ArrayPrint(events);
     }
   else
     {
      PrintFormat("Fehler beim Erhalt der Ereignisse für den Länder-Code %s, error %d",
                  germany_code,GetLastError());
      //--- Skript wurde vorzeitig beendet
      return;
     }
//--- Abrufen der Beschreibung des letzten Ereignisses vom Array events[]
   MqlCalendarEvent event;
   ulong event_id=events[events_count-1].id;
   if(CalendarEventById(event_id,event))
     {
      MqlCalendarCountry country; 
      CalendarCountryById(event.country_id,country);
      PrintFormat("Ereignisbeschreibung von event_id=%d erhalten",event_id);
      PrintFormat("Land: %s (Länder-Code = %d)",country.name,event.country_id);
      PrintFormat("Ereignisname: %s",event.name);
      PrintFormat("Ereignis-Code: %s",event.event_code);
      PrintFormat("Ereigniswichtigkeit: %s",EnumToString((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance));
      PrintFormat("Ereignis-Typ: %s",EnumToString((ENUM_CALENDAR_EVENT_TYPE)event.type));
      PrintFormat("Ereignis-Sektor: %s",EnumToString((ENUM_CALENDAR_EVENT_SECTOR)event.sector));
      PrintFormat("Ereignis-Häufigkeit: %s",EnumToString((ENUM_CALENDAR_EVENT_FREQUENCY)event.frequency));
      PrintFormat("Art der Ereignisveröffentlichung: %s",EnumToString((ENUM_CALENDAR_EVENT_TIMEMODE)event.time_mode));
      PrintFormat("Ereignis-Maßeinheit: %s",EnumToString((ENUM_CALENDAR_EVENT_UNIT)event.unit));
      PrintFormat("Anzahl der Dezimalstellen: %d",event.digits);
      PrintFormat("Ereignis-Multiplikator: %s",EnumToString((ENUM_CALENDAR_EVENT_MULTIPLIER)event.multiplier));
      PrintFormat("Quell-URL: %s",event.source_url);
     }
   else
      PrintFormat("Fehler beim Erhalt der Ereignisbeschreibung für event_d=%s, Fehler %d",
                  event_id,GetLastError());
  }
/*
  Ergebnis:
  Ereignisse Deutschlands: 50
             [id] [type] [sector] [frequency] [time_mode] [country_id] [unit] [importance] [multiplier] [digits]                                [source_url]                       [event_code]                             [name] [reserved]
   [ 0] 276010001      1        6           2           0          276      1            1            0        1 "https://www.destatis.de/EN/Homepage.html"  "exports-mm"                       "Exports m/m"                               0
   [ 1] 276010002      1        6           2           0          276      1            1            0        1 "https://www.destatis.de/EN/Homepage.html"  "imports-mm"                       "Imports m/m"                               0
   [ 2] 276010003      1        4           2           0          276      1            1            0        1 "https://www.destatis.de/EN/Homepage.html"  "import-price-index-mm"            "Import Price Index m/m"                    0
   [ 3] 276010004      1        4           2           0          276      1            1            0        1 "https://www.destatis.de/EN/Homepage.html"  "import-price-index-yy"            "Import Price Index y/y"                    0
   ....
   [47] 276500001      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-manufacturing-pmi"         "Markit Manufacturing PMI"                  0
   [48] 276500002      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-services-pmi"              "Markit Services PMI"                       0
   [49] 276500003      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-composite-pmi"             "Markit Composite PMI"                      0
  Ereignisbeschreibung für event_id=276500003 erhalten
  Land: Deutschland (Länder-Code = 276)
  Ereignis-Name: Markit Composite PMI
  Ereignis-Code: markit-composite-pmi
   Ereigniswichtigkeit: CALENDAR_IMPORTANCE_MODERATE
   Ereignis-Typ: CALENDAR_TYPE_INDICATOR
   Ereignis-Sektor: CALENDAR_SECTOR_BUSINESS
   Ereignis-Häufigkeit: CALENDAR_FREQUENCY_MONTH
   Art der Ereignisveröffentlichung: CALENDAR_TIMEMODE_DATETIME
   Ereignis-Maßeinheit: CALENDAR_UNIT_NONE
  Anzahl der Dezimalstellen: 1
   Ereignis-Multiplikator: CALENDAR_MULTIPLIER_NONE
   Quell-URL: https://www.markiteconomics.com
*/

Siehe auch

CalendarEventByCountry, CalendarEventByCurrency, CalendarValueById