//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- récupère l'ID du tout premier graphique ouvert dans le terminal client
long chart_id= ChartFirst();
//--- récupère aussi le symbole et la période du graphique en utilisant l'ID obtenu
string symbol = ChartSymbol(chart_id);
ENUM_TIMEFRAMES period = ChartPeriod(chart_id);
//--- affiche la description du premier graphique du terminal client dans le 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));
/*
résultat :
ID of the first chart of the client terminal: 133246248352168440, chart symbol: EURUSD, chart period: M1
*/
}
|