//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- obtemos o identificador do primeiro gráfico aberto no terminal do cliente
long chart_id= ChartFirst();
//--- mediante o identificador recebido, obtemos adicionalmente o símbolo e o período do gráfico
string symbol = ChartSymbol(chart_id);
ENUM_TIMEFRAMES period = ChartPeriod(chart_id);
//--- registramos no log a descrição do primeiro gráfico do terminal do 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
*/
}
|