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("독일의 이벤트: %d",events_count);
      ArrayPrint(events);
     }
   else
     {
      PrintFormat("국가 코드 %s, 오류 %d에 대한 이벤트를 수신하지 못했습니다.",
                  germany_code,GetLastError());
      //--- 스크립트 미리 완료
      return;
     }
//--- events[] 배열에서 마지막 이벤트에 대한 설명을 가져오기
   MqlCalendarEvent 이벤트;
   ulong event_id=events[events_count-1].id;
   if(CalendarEventById(event_id,event))
     {
      MqlCalendarCountry 국가; 
      CalendarCountryById(event.country_id,country);
      PrintFormat("이벤트 설명과 event_id=%d가 수신됨",event_id);
      PrintFormat("국가: %s (country code = %d)",country.name,event.country_id);
      PrintFormat("이벤트 이름: %s",event.name);
      PrintFormat("이벤트 코드: %s",event.event_code);
      PrintFormat("이벤트 중요도: %s",EnumToString((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance));
      PrintFormat("이벤트 유형: %s",EnumToString((ENUM_CALENDAR_EVENT_TYPE)event.type));
      PrintFormat("이벤트 섹터: %s",EnumToString((ENUM_CALENDAR_EVENT_SECTOR)event.sector));
      PrintFormat("이벤트 빈도: %s",EnumToString((ENUM_CALENDAR_EVENT_FREQUENCY)event.frequency));
      PrintFormat("이벤트 해제 모드: %s",EnumToString((ENUM_CALENDAR_EVENT_TIMEMODE)event.time_mode));
      PrintFormat("이벤트 측정 단위: %s",EnumToString((ENUM_CALENDAR_EVENT_UNIT)event.unit));
      PrintFormat("소수점 자릿 수: %d",event.digits);
      PrintFormat("이벤트 승수: %s",EnumToString((ENUM_CALENDAR_EVENT_MULTIPLIER)event.multiplier));
      PrintFormat("소스 URL: %s",event.source_url);
     }
   else
      PrintFormat("event_d=%s, error %d에 대한 이벤트 설명을 수신하지 못했습니다",
                  event_id,GetLastError());
  }
/*
  결과:
  독일 이벤트: 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"                       "수출 m/m"                               0
   [ 1] 276010002      1        6           2           0          276      1            1            0        1 "https://www.destatis.de/EN/Homepage.html"  "imports-mm"                       "수입 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"            "수입 가격 인덱스 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"            "수입 가격 인덱스 y/y"                    0
   ....
   [47] 276500001      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-manufacturing-pmi"         "Markit 제조 PMI"                  0
   [48] 276500002      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-services-pmi"              "Markit 서비스 PMI"                       0
   [49] 276500003      1        8           2           0          276      0            2            0        1 "https://www.markiteconomics.com"           "markit-composite-pmi"             "Markit 컴포짓 PMI"                      0
  event_id=276500003 가 수신된 이벤트 설명
  국가: 독 (country code = 276)
  이멘트명: Markit Composite PMI
  이벤트 코드: markit-composite-pmi
   이벤트 중요도: CALENDAR_IMPORTANCE_MODERATE
   이벤트 유형: CALENDAR_TYPE_INDICATOR
   이벤트 섹터: CALENDAR_SECTOR_BUSINESS
   이벤트 빈도: CALENDAR_FREQUENCY_MONTH
   이벤트 릴리스 모드: CALENDAR_TIMEMODE_DATETIME
   이벤트 측정 단위: CALENDAR_UNIT_NONE
  소수 자릿수: 1
   값 승수: CALENDAR_MULTIPLIER_NONE
   소스 URL: https://www.markiteconomics.com
*/

추가 참조

CalendarEventByCountry, CalendarEventByCurrency, CalendarValueById