#define SYMBOL_NAME "EURUSD"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- déclare un tableau avec le type de structure MqlTick de dimension 1
MqlTick tick[1]={};
//--- récupère les derniers prix pour le symbole SYMBOL_NAME dans la structure MqlTick
if(!SymbolInfoTick(SYMBOL_NAME, tick[0]))
{
Print("SymbolInfoTick() failed. Error ", GetLastError());
return;
}
//--- envoie dans le journal les données obtenues
PrintFormat("Latest price data for the '%s' symbol:", SYMBOL_NAME);
ArrayPrint(tick);
/*
résultat :
Latest price data for the 'EURUSD' symbol:
[time] [bid] [ask] [last] [volume] [time_msc] [flags] [volume_real]
[0] 2024.05.17 23:58:54 1.08685 1.08695 0.0000 0 1715990334319 6 0.00000
*/
}
|