How to get current milliseconds in MetaTrader4 Terminal?

Viewed 7185

How can I get current milliseconds from MQL4 using an Expert Advisor.

i.e.: in Java we can get current milliseconds using system.currenttimemillis()

5 Answers
dt1 = TimeLocal()+2;
do
{
  dt2 = TimeLocal();
}
while(TimeSecons(dt2) < TimeSecons(dt1));

after finish you may count time from 0.000

Just cast values to ulong and make sure to multiply TimeGMT() with 1000

for print result cast to string :

ulong time = (ulong) TimeGMT()*1000 - (ulong) GetTickCount() ; 
Print("milliseconds: ",  (string)time);
Related