CalendarEventById

IDによってイベントの説明を取得します。

bool  CalendarEventById(
  ulong                event_id,    // イベントID
  MqlCalendarEvent&    event       // イベントの説明を受け取るための変数
  );

パラメータ

event_id

[in] イベントID

event

[out] イベントの説明を受け取るためのMqlCalendarEvent型の変数

戻り値

成功の場合は true、それ以外の場合は false。エラー情報を取得するためにはGetLastError()関数を呼び出します。可能なエラー:

  • 4001 – ERR_INTERNAL_ERROR(一般的なランタイムエラー)
  • 5402 – ERR_CALENDAR_NO_DATA(無効な国)
  • 5401 – ERR_CALENDAR_TIMEOUT(リクエスト制限時間の超過)

例:

//+------------------------------------------------------------------+
//| スクリプトプログラム開始関数                                              |
//+------------------------------------------------------------------+
void OnStart()
 {
//--- ドイツの国コード(ISO 3166-1 Alpha-2)
  string germany_code="DE";
//--- ドイツのイベントを取得する
  MqlCalendarEvent events[];
  int events_count=CalendarEventByCountry(germany_code,events);
//--- ドイツのイベントを操作ログに表示する
  if(events_count>0)
    {
    PrintFormat("Germany events: %d",events_count);
    ArrayPrint(events);
    }
  else
    {
    PrintFormat("Failed to receive events for the country code %s, error %d",
                 germany_code,GetLastError());
    //--- スクリプトが完了した
    return;
    }
//--- events[]配列の最後のイベントの説明を取得する
  MqlCalendarEvent event;
  ulong event_id=events[events_count-1].id;
  if(CalendarEventById(event_id,event))
    {
    MqlCalendarCountry country;
    CalendarCountryById(event.country_id,country);
    PrintFormat("Event description with event_id=%d received",event_id);
    PrintFormat("Country: %s (country code = %d)",country.name,event.country_id);
    PrintFormat("Event name: %s",event.name);
    PrintFormat("Event code: %s",event.event_code);
    PrintFormat("Event importance: %s",EnumToString((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance));
    PrintFormat("Event type: %s",EnumToString((ENUM_CALENDAR_EVENT_TYPE)event.type));
    PrintFormat("Event sector: %s",EnumToString((ENUM_CALENDAR_EVENT_SECTOR)event.sector));
    PrintFormat("Event frequency: %s",EnumToString((ENUM_CALENDAR_EVENT_FREQUENCY)event.frequency));
    PrintFormat("Event release mode: %s",EnumToString((ENUM_CALENDAR_EVENT_TIMEMODE)event.time_mode));
    PrintFormat("Event measurement unit: %s",EnumToString((ENUM_CALENDAR_EVENT_UNIT)event.unit));
    PrintFormat("Number of decimal places: %d",event.digits);
    PrintFormat("Event multiplier: %s",EnumToString((ENUM_CALENDAR_EVENT_MULTIPLIER)event.multiplier));
    PrintFormat("Source URL: %s",event.source_url);
    }
  else
    PrintFormat("Failed to get event description for event_d=%s, error %d",
                 event_id,GetLastError());
 }
/*
  結果:
  Germany events: 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
  Event description with event_id=276500003 received
  Country: Germany (country code = 276)
  Event name: Markit Composite PMI
  Event code: markit-composite-pmi
  Event importance: CALENDAR_IMPORTANCE_MODERATE
  Event type: CALENDAR_TYPE_INDICATOR
  Event sector: CALENDAR_SECTOR_BUSINESS
  Event frequency: CALENDAR_FREQUENCY_MONTH
  Event release mode: CALENDAR_TIMEMODE_DATETIME
  Event measurement unit: CALENDAR_UNIT_NONE
  Number of decimal places: 1
  Value multiplier: CALENDAR_MULTIPLIER_NONE
  Source URL: https://www.markiteconomics.com
*/

参照

CalendarEventByCountryCalendarEventByCurrencyCalendarValueById