//+------------------------------------------------------------------+
//| 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_id, chart_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 symbol: GBPUSD
Chart symbol with ID 132966427583395104: GBPUSD
The chart with ID 1234567890 does not exist
*/
}
|