ChartSymbol

Devuelve el nombre del símbolo del gráfico especificado.

string  ChartSymbol(
   long  chart_id=0      // identificador del gráfico
   );

Parámetros

chart_id=0

[in]  Identificador del gráfico. 0 significa el gráfico actual.

Valor devuelto

Si el gráfico no existe, se devuelve una cadena vacía.

Ejemplo:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- obtenemos el símbolo del gráfico actual y mostramos el valor resultante en el registro
   string chart_symbol = ChartSymbol();
   Print("Current chart symbol: "chart_symbol);
   
//--- tomamos el identificador de un gráfico existente (en este caso, el actual)
   long chart_id=ChartID();
   chart_symbol=ChartSymbol(chart_id);
   PrintFormat("Chart symbol with ID %I64d: %s"chart_idchart_symbol);
 
//--- establecemos el identificador aleatorio del gráfico al obtener el símbolo
   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);
   /*
  resultado:
   Current chart symbolGBPUSD
   Chart symbol with ID 132966427583395104GBPUSD
   The chart with ID 1234567890 does not exist
   */
  }

Véase también

ChartSetSymbolPeriod