CalendarCountryById
ID'sine göre ülke açıklaması elde edin.
bool CalendarCountryById(
const long country_id,
MqlCalendarCountry& country
);
|
Parametreler
country_id
[in] Ülke ID'si (ISO 3166-1).
country
[out] Ülke açıklaması almak için MqlCalendarCountry tip değişkeni
Geri dönüş değeri
- 4001 – ERR_INTERNAL_ERROR (genel çalışma zamanı hatası),
- 5402 – ERR_CALENDAR_NO_DATA (ülke bulunamadı),
- 5401 – ERR_CALENDAR_TIMEOUT (istek süresi sınırı aşıldı).
Örnek:
//+------------------------------------------------------------------+
//| Script programı başlatma fonksiyonu |
//+------------------------------------------------------------------+
void OnStart()
{
//--- ekonomik takvimden ülkelerin listesini elde et
MqlCalendarCountry countries[];
int count=CalendarCountries(countries);
//--- sonucu kontrol et
if(count==0)
PrintFormat("CalendarCountries() 0 geri döndürdü! Error %d",GetLastError());
//--- eğer iki veya daha fazla ülke varsa
if(count>=2)
{
MqlCalendarCountry country;
//--- şimdi ID'sine göre ülke açıklaması elde et
if(CalendarCountryById(countries[1].id, country))
{
//--- ülke açıklaması hazırla
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);
//--- ülke açıklamasını görüntüle
Print(descr);
}
else
Print("CalendarCountryById() başarısız oldu. Hata ",GetLastError());
}
//---
}
/*
Sonuç:
id = 999
name = European Union
code = EU
currency = EUR
currency_symbol = €
url_name = european-union
*/
|
Ayrıca bakınız
CalendarCountries, CalendarEventByCountry