//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- ottenere l'ID del primo grafico aperto nel terminale client
long chart_id= ChartFirst();
//--- ottenere inoltre il simbolo del grafico e il periodo utilizzando l'ID ottenuto
string symbol = ChartSymbol(chart_id);
ENUM_TIMEFRAMES period = ChartPeriod(chart_id);
//--- visualizzare la descrizione del primo grafico del terminale cliente nel journal
PrintFormat("ID of the first chart of the client terminal: %I64d, chart symbol: %s, chart period: %s", chart_id, symbol, StringSubstr(EnumToString(period), 7));
/*
risultato:
ID of the first chart of the client terminal: 133246248352168440, chart symbol: EURUSD, chart period: M1
*/
}
|