SymbolExist
Belirtilen ada sahip bir sembol olup olmadığını kontrol eder.
bool SymbolExist(
const string name,
bool& is_custom
);
|
Parametreler
name
[in] Sembol adı.
is_custom
[out] Başarılı yürütmenin akabinde ayarlanan kullanıcı tanımlı sembol özelliği. Eğer doğruysa, algılanan sembol bir kullanıcı tanımlı semboldür.
Geri dönüş değeri
Örnek:
#define SYMBOL_NAME "GBPUSDn"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- özel sembol bayrağını bildir ve adı SYMBOL_NAME'de belirtilen sembolün varlığını kontrol et
bool custom = false;
bool result = SymbolExist(SYMBOL_NAME, custom);
//--- varsayılan 'sembol bulunamadı' mesaj metnini bildir
string text = StringFormat("The symbol '%s' was not found among either the standard or custom symbols.", SYMBOL_NAME);
//--- sembol bulunursa, sembolün hangi listede bulunduğuna bağlı olarak bir mesaj metni oluştur
if(result)
{
//--- eğer bu standart bir sembol ise
if(!custom)
text = StringFormat("The '%s' symbol is available on the server.", SYMBOL_NAME);
//--- eğer bu özel bir sembol ise
else
text = StringFormat("The symbol '%s' was found in the list of custom symbols.", SYMBOL_NAME);
}
//--- kontrol sonucuyla ilgili mesajı günlüğe gönder
Print(text);
/*
standart 'GBPUSD' sembolü için sonuç:
The 'GBPUSD' symbol is available on the server.
özel 'GBPUSDx' sembolü için sonuç:
The symbol 'GBPUSDx' was found in the list of custom symbols.
olmayan 'GBPUSDn' sembolü için sonuç:
The symbol 'GBPUSDn' was not found among either the standard or custom symbols.
*/
}
|
Ayrıca bakınız
SymbolsTotal, SymbolSelect, Kullanıcı tanımlı semboller