CalendarEventByCountry

根据指定国家代码获得日历中可用的所有事件描述数组。

int  CalendarEventByCountry(

   string               country_code,     // 国家代码名称(ISO 3166-1 alpha-2)

   MqlCalendarEvent&    events[]          //用于接收描述数组的变量

   );

参数

country_code

[in]  国家代码名称(ISO 3166-1 alpha-2)

events[]

[out] MqlCalendarEvent类型数组,用于接收指定国家的所有事件描述。

返回值

所接收的描述数量。若要获得有关错误的信息,请调用GetLastError()函数。可能错误:

  • 4001 – ERR_INTERNAL_ERROR(一般运行时错误)。
  • 4004 – ERR_NOT_ENOUGH_MEMORY(内存不足,无法执行请求)。
  • 5401 – ERR_CALENDAR_TIMEOUT(超过请求时限)。
  • 执行 ArrayResize()失败的错误

例如:

//+------------------------------------------------------------------+

//| 脚本程序起始函数                                                     |

//+------------------------------------------------------------------+

void OnStart()

  {

//--- 欧盟国家代码(ISO 3166-1 Alpha-2)

   string EU_code="EU";

//--- 获得欧盟事件

   MqlCalendarEvent events[];

   int events_count=CalendarEventByCountry(EU_code,events);

//--- 在“日志”中显示欧盟事件

   if(events_count>0)

     {

      PrintFormat("EU events: %d",events_count);

      ArrayPrint(events);

     }

//---

  }

/*

  结果:

  欧盟事件:56

             [id] [type]  [country_id] [unit] [importance] [multiplier] [digits] [event_code]

   [ 0] 999010001      0          999      0            2            0        0  "ECB Non-monetary Policy Meeting"

   [ 1] 999010002      0          999      0            2            0        0  "ECB Monetary Policy Meeting Account

   [ 2] 999010003      0          999      0            3            0        0  "ECB Monetary Policy Press Conferenc

   [ 3] 999010004      0          999      0            3            0        0  "ECB President Draghi Speech"

   [ 4] 999010005      0          999      0            2            0        0  "ECB Vice President Constancio Speec

   [ 5] 999010006      1          999      1            3            0        2  "ECB Deposit Facility Rate Decision"

   [ 6] 999010007      1          999      1            3            0        2  "ECB Interest Rate Decision"

   [ 7] 999010008      0          999      0            2            0        0  "ECB Economic Bulletin"

   [ 8] 999010009      1          999      2            2            3        3  "ECB Targeted LTRO"

   [ 9] 999010010      0          999      0            2            0        0  "ECB Executive Board Member Praet Sp

   [10] 999010011      0          999      0            2            0        0  "ECB Executive Board Member Mersch S   

   ...



*/

另见

CalendarCountriesCalendarCountryById