#define SYMBOL_NAME "GBPHKD"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- imposta il flag del risultato della ricerca dei simboli del server
bool found = false;
//--- trovare il simbolo 'SYMBOL_NAME' nella lista di tutti i simboli del server
int total = SymbolsTotal(false);
for(int i=0; i<total; i++)
{
//--- ottenere un nome di simbolo dalla lista tramite l'indice del ciclo
string name = SymbolName(i, false);
//--- se questo è il simbolo desiderato, invia il suo nome e la sua posizione nella lista al journal ed esce dal ciclo
if(name == SYMBOL_NAME)
{
PrintFormat("The '%s' symbol was found in the list of server symbols at index %d", name, i);
found = true;
break;
}
}
//--- se un simbolo non viene trovato sul server, segnalarlo prima di spegnere
if(!found)
PrintFormat("The '%s' symbol was not found on the server.", SYMBOL_NAME);
}
|