#define SYMBOL_NAME "GBPHKD"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- initialise le flag du résultat de la recherche du symbole
bool found = false;
//--- cherche le symbole 'SYMBOL_NAME' dans la liste de tous les symboles du serveur
int total = SymbolsTotal(false);
for(int i=0; i<total; i++)
{
//--- obtient le nom du symbole dans la liste en bouclant sur les indices
string name = SymbolName(i, false);
//--- si c'est le symbole demandé, envoie son nom et sa position dans la liste dans le journal et sort de la boucle
if(name == SYMBOL_NAME)
{
PrintFormat("The '%s' symbol was found in the list of server symbols at index %d", name, i);
found = true;
break;
}
}
//--- si aucun symbole n'est trouvé sur le serveur, on l'indique avant la fin
if(!found)
PrintFormat("The '%s' symbol was not found on the server.", SYMBOL_NAME);
}
|