ChartSymbol

Retourne le nom du symbole du graphique indiqué.

string  ChartSymbol(
   long  chart_id=0      // identificateur du graphique
   );

Paramètres

chart_id=0

[in]  L'identificateur du graphique. 0 signifie le graphique courant.

Valeur de Retour

Si le graphique n'existe pas, retourne une chaîne vide.

Exemple :

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- récupère le symbole actuel du graphique et affiche la valeur obtenue dans le journal
   string chart_symbol = ChartSymbol();
   Print("Current chart symbol: "chart_symbol);
   
//--- prends l'identifiant du graphique existante (dans cas cas, l'actuel)
   long chart_id=ChartID();
   chart_symbol=ChartSymbol(chart_id);
   PrintFormat("Chart symbol with ID %I64d: %s"chart_idchart_symbol);
 
//--- définit un identifiant de graphique aléatoire lors de la réception d'un symbole
   chart_symbol = ChartSymbol(1234567890);
   if(chart_symbol=="")
      Print("The chart with ID 1234567890 does not exist");
   else
      Print("Chart symbol with ID 1234567890: "chart_symbol);
   /*
   résultat :
   Current chart symbolGBPUSD
   Chart symbol with ID 132966427583395104GBPUSD
   The chart with ID 1234567890 does not exist
   */
  }

Voir aussi

ChartSetSymbolPeriod