CalendarCountryById
ID로 국가 설명 가져오기.
bool CalendarCountryById(
const long country_id,
MqlCalendarCountry& country
);
|
매개변수
country_id
[in] Country ID (ISO 3166-1).
country
[out] MqlCalendarCountry 국가 설명을 수신하기 위한 형식 변수.
값 반환
- 4001 – ERR_INTERNAL_ERROR (일반 실행시간 오류),
- 5402 – ERR_CALENDAR_NO_DATA (국가를 찾을 수 없음),
- 5401 – ERR_CALENDAR_TIMEOUT (요청시간 제한 초과).
예를 들어:
//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 이코노믹 캘린더에서 국가 목록 가져오기
MqlCalendarCountry countries[];
int count=CalendarCountries(countries);
//--- 결과 확인
if(count==0)
PrintFormat("CalendarCountries() returned 0! Error %d",GetLastError());
//--- 만약 두 개 이상의 국가가 있다면
if(count>=2)
{
MqlCalendarCountry country;
//--- ID로 국가 설명을 가져오기
if(CalendarCountryById(countries[1].id, country))
{
//--- 국가 설명 준비
string descr="id = "+IntegerToString(country.id)+"\n";
descr+=("name = " + country.name+"\n");
descr+=("code = " + country.code+"\n");
descr+=("currency = " + country.currency+"\n");
descr+=("currency_symbol = " + country.currency_symbol+"\n");
descr+=("url_name = " + country.url_name);
//--- 국가 설명 표시
Print(descr);
}
else
Print("CalendarCountryById() failed. Error ",GetLastError());
}
//---
}
/*
결과:
id = 999
name = European Union
코드 = EU
통화 = EUR
currency_symbol = €
url_name = european-union
*/
|
추가 참조
CalendarCountries, CalendarEventByCountry