CalendarCountries

获得“日历”中可用的国家名称数组。

int  CalendarCountries(
   MqlCalendarCountry&  countries[]         // 用于接收“日历”国家描述列表的数组
   );

参数

countries[]

[out] MqlCalendarCountry类型数组,用于接收所有“日历”国家的描述。

返回值

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

  • 4001 – ERR_INTERNAL_ERROR(一般运行时错误)。
  • 5401 – ERR_CALENDAR_TIMEOUT(超过请求时限)。
  • 5400 – ERR_CALENDAR_MORE_DATA(数组大小不足以接收所有国家的描述,只可以接收那些适合的国家)。

 

例如:

//+------------------------------------------------------------------+
//| 脚本程序起始函数                                                     |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 从经济日历中获得国家列表
   MqlCalendarCountry countries[];
   int count=CalendarCountries(countries);
//--- 在“日志”中显示数组
   if(count>0)
      ArrayPrint(countries);
   else
      PrintFormat("CalendarCountries() returned 0! Error %d",GetLastError());
/*
  结果:
        [id]           [name] [code] [currency] [currency_symbol]       [url_name] [reserved]
   [ 0]    0 "Worldwide"      "WW"   "ALL"      ""                "worldwide"               0
   [ 1]  999 "European Union" "EU"   "EUR"      "�"               "european-union"          0
   [ 2]  840 "United States"  "US"   "USD"      "$"               "united-states"           0
   [ 3]  124 "Canada"         "CA"   "CAD"      "$"               "canada"                  0
   [ 4]   36 "Australia"      "AU"   "AUD"      "$"               "australia"               0
   [ 5]  554 "New Zealand"    "NZ"   "NZD"      "$"               "new-zealand"             0
   [ 6]  392 "Japan"          "JP"   "JPY"      "Ґ"               "japan"                   0
   [ 7]  156 "China"          "CN"   "CNY"      "Ґ"               "china"                   0
   [ 8]  826 "United Kingdom" "GB"   "GBP"      "Ј"               "united-kingdom"          0
   [ 9]  756 "Switzerland"    "CH"   "CHF"      "₣"               "switzerland"             0
   [10]  276 "Germany"        "DE"   "EUR"      "�"               "germany"                 0
   [11]  250 "France"         "FR"   "EUR"      "�"               "france"                  0
   [12]  380 "Italy"          "IT"   "EUR"      "�"               "italy"                   0
   [13]  724 "Spain"          "ES"   "EUR"      "�"               "spain"                   0
   [14]   76 "Brazil"         "BR"   "BRL"      "R$"              "brazil"                  0
   [15]  410 "South Korea"    "KR"   "KRW"      "₩"               "south-korea"             0
*/
  }

另见

CalendarEventByCountryCalendarCountryById