SymbolExist

Prüft, ob ein Symbol mit dem angegebenen Namen existiert.

bool  SymbolExist(
   const string  name,    // Symbolname
   bool&   is_custom      // Eigenschaften des nutzerdefinierten Symbols
   );

Parameter

name

[in]  Symbolname.

is_custom

[out]  Eigenschaften des nutzerdefinierten Symbols, die bei erfolgreicher Ausführung festgelegt werden. Wenn true, ist das erkannte Symbol ein nutzerdefiniertes Symbol.

Rückgabewert

Wenn false, wurde das Symbol unter den standardmäßigen und den nutzerdefinierten Symbolen nicht gefunden.

Beispiel:

#define SYMBOL_NAME "GBPUSDn"
//+------------------------------------------------------------------+
//| Skript Programm Start Funktion                                   |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- deklariere das nutzerdefinierte Symbol-Flag und prüfe das Vorhandensein eines Symbols, dessen Name in SYMBOL_NAME angegeben ist
   bool custom = false;
   bool result = SymbolExist(SYMBOL_NAMEcustom);
   
//--- Deklarieren des Standardtextes für den Fehler „Symbol nicht gefunden“
   string text = StringFormat("The symbol '%s' was not found among either the standard or custom symbols."SYMBOL_NAME);
   
//--- wenn ein Symbol gefunden wurde, wird ein Nachrichtentext erstellt, je nachdem, in welcher Liste das Symbol gefunden wurde
   if(result)
     {
      //--- falls es ein Standardsymbol ist
      if(!custom)
         text = StringFormat("The '%s' symbol is available on the server."SYMBOL_NAME);
      //--- wenn dies ein nutzerdefiniertes Symbol ist
      else
         text = StringFormat("The symbol '%s' was found in the list of custom symbols."SYMBOL_NAME);
     }
     
//--- Senden der Nachricht über das Prüfergebnis an das Journal
   Print(text);
   /*
   result for standard 'GBPUSD' symbol:
   The 'GBPUSDsymbol is available on the server.
   
   result for custom 'GBPUSDx' symbol:
   The symbol 'GBPUSDxwas found in the list of custom symbols.
   
   result for missing 'GBPUSDn' symbol:
   The symbol 'GBPUSDnwas not found among either the standard or custom symbols.
   */
  }

Siehe auch

SymbolsTotal, SymbolSelect, Custom symbols