#define SYMBOL_NAME "GBPHKD"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- set the flag of the server symbol search result
bool found = false;
//--- find the 'SYMBOL_NAME' symbol in the list of all server symbols
int total = SymbolsTotal(false);
for(int i=0; i<total; i++)
{
//--- get a symbol name in the list by loop index
string name = SymbolName(i, false);
//--- if this is the desired symbol, send its name and position in the list to the journal and exit the loop
if(name == SYMBOL_NAME)
{
PrintFormat("The '%s' symbol was found in the list of server symbols at index %d", name, i);
found = true;
break;
}
}
//--- if a symbol is not found on the server, report this before shutting down
if(!found)
PrintFormat("The '%s' symbol was not found on the server.", SYMBOL_NAME);
}
|