//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- obtenemos el identificador del primer gráfico abierto en el terminal de cliente
long chart_id= ChartFirst();
//--- según el identificador recibido, obtenemos adicionalmente el símbolo y el periodo del gráfico
string symbol = ChartSymbol(chart_id);
ENUM_TIMEFRAMES period = ChartPeriod(chart_id);
//--- mostramos la descripción del primer gráfico del terminal del cliente
PrintFormat("ID of the first chart of the client terminal: %I64d, chart symbol: %s, chart period: %s", chart_id, symbol, StringSubstr(EnumToString(period), 7));
/*
resultado:
ID of the first chart of the client terminal: 133246248352168440, chart symbol: EURUSD, chart period: M1
*/
}
|