#define SYMBOL_NAME "GBPUSDn"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- declaramos um sinalizador de símbolo personalizado e verificamos a presença de um símbolo com o nome especificado em SYMBOL_NAME
bool custom = false;
bool result = SymbolExist(SYMBOL_NAME, custom);
//--- declaramos o texto da mensagem, por padrão sobre o símbolo não encontrado
string text = StringFormat("The symbol '%s' was not found among either the standard or custom symbols.", SYMBOL_NAME);
//--- se o símbolo for encontrado, criamos o corpo da mensagem de acordo com a lista na qual o símbolo foi encontrado
if(result)
{
//--- se for um símbolo padrão
if(!custom)
text = StringFormat("The '%s' symbol is available on the server.", SYMBOL_NAME);
//--- se for um símbolo personalizado
else
text = StringFormat("The symbol '%s' was found in the list of custom symbols.", SYMBOL_NAME);
}
//--- imprimimos no log a mensagem sobre o resultado da verificação
Print(text);
/*
resultado para o símbolo padrão 'GBPUSD':
The 'GBPUSD' symbol is available on the server.
resultado para o símbolo personalizado 'GBPUSDx':
The symbol 'GBPUSDx' was found in the list of custom symbols.
resultado para o símbolo ausente 'GBPUSDn':
The symbol 'GBPUSDn' was not found among either the standard or custom symbols.
*/
}
|