CalendarEventByCurrency

根据指定货币获得日历中可用的所有事件描述数组。

int  CalendarEventByCurrency(
   const string         currency,     // 国家货币代码名称
   MqlCalendarEvent&    events[]      // 用于接收描述数组的变量
   );

参数

currency

[in]  国家货币代码名称。

events[]

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

返回值

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

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

 

例如:

//+------------------------------------------------------------------+
//| 脚本程序起始函数                                                     |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 声明用于接收经济日历事件的数组
      MqlCalendarEvent events[];
//--- 获得欧盟货币事件      
      int count = CalendarEventByCurrency("EUR",events);
      Print("count = ", count);
//--- 10个事件足以满足当前示例
      if(count>10)
         ArrayResize(events,10);
//--- 在“日志”中显示事件        
      ArrayPrint(events);
  }
/*
  结果:
             [id] [type] [country_id] [unit] [importance]                                        [source_url]                                 [event_code]                                    [name] 
   [0] 999010001      0          999      0            2 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-non-monetary-policy-meeting"            "ECB Non-monetary Policy Meeting"                
   [1] 999010002      0          999      0            2 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-monetary-policy-meeting-accounts"       "ECB Monetary Policy Meeting Accounts"           
   [2] 999010003      0          999      0            3 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-monetary-policy-press-conference"       "ECB Monetary Policy Press Conference"           
   [3] 999010004      0          999      0            3 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-president-draghi-speech"                "ECB President Draghi Speech"                    
   [4] 999010005      0          999      0            2 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-vice-president-vitor-constancio-speech" "ECB Vice President Constancio Speech"           
   [5] 999010006      1          999      1            3 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-deposit-rate-decision"                  "ECB Deposit Facility Rate Decision"             
   [6] 999010007      1          999      1            3 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-interest-rate-decision"                 "ECB Interest Rate Decision"                     
   [7] 999010008      0          999      0            2 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-economic-bulletin"                      "ECB Economic Bulletin"                          
   [8] 999010009      1          999      2            2 "https://www.ecb.europa.eu/home/html/index.en.html" "targeted-ltro"                              "ECB Targeted LTRO"                              
   [9] 999010010      0          999      0            2 "https://www.ecb.europa.eu/home/html/index.en.html" "ecb-executive-board-member-praet-speech"    "ECB Executive Board Member Praet Speech"        
*/  

另见

CalendarEventByIdCalendarEventByCountry