How can I get the Currenttime in Milliseconds in EA

 

Hi team, 


The current Currentime() function is getting the time but in seconds not in milliseconds, can anyone help me if I want to get the current time in milliseconds using EA. 


Thanks 

 
You can't.
 
Yfi :

Hi team, 


The current Currentime() function is getting the time but in seconds not in milliseconds, can anyone help me if I want to get the current time in milliseconds using EA. 


Thanks 

Good morning
try to see
GetTickCount - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

Documentation on MQL5: Common Functions / GetTickCount
Documentation on MQL5: Common Functions / GetTickCount
  • www.mql5.com
GetTickCount - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Yfi:

Hi team, 


The current Currentime() function is getting the time but in seconds not in milliseconds, can anyone help me if I want to get the current time in milliseconds using EA. 


Thanks 

Here, this library shows you how to do it.


Edit:

But, be aware TimeCurrent () is a server based time, so you might need to sync this regularly. Depending on your needs, of course.
 

This function returns the milliseconds since the terminal has been launched.

GetMicrosecondCount gives the microseconds since start of the program (EA/Script/Indicator/Service)


EDIT:

I think this information is wrong. Correct is:

GetTickCount64() returns the milliseconds since the system was started.

GetMicrosecondCount() returns the microseconds since the Terminal was started.

 
How useful can it be to know how many milliseconds passed since 1970.01.01?
 
Yashar Seyyedin #:
How useful can it be to know how many milliseconds passed since 1970.01.01?
throw it twice and make the difference....
 
Dominik Egert #:
Here, this library shows you how to do it.


Edit:

But, be aware TimeCurrent () is a server based time, so you might need to sync this regularly. Depending on your needs, of course.

There is no way to get the real milliseconds either for local or for server time.

This code is only simulating it. If you need relative time, it could be fine, if you need absolute time it's not accurate.

 
Gerard Willia G J B M Dinh Sy #:
throw it twice and make the difference....

I know bro! For that purpose you do not need it from 1970.01.01

 
Yashar Seyyedin # :
I know bro!

I'm not your brother! in no way!!!

 
Thank you guys so much 
Reason: