Features of the mql5 language, subtleties and tricks - page 90

 
Alexey Navoykov:

Here is a variant using a high-resolution winapi timer, giving an accuracy of 5.6e-13 seconds.

What are you talking about? It turns out that the frequency is 1786 GHz. This is already a frequency of infrared radiation. :))
You just mixed up the frequency with the counter there.
It's really 3.8e-07 seconds. That is about a third of a microsecond. Not significantly different from the MQL


 
Nikolai Semko:

What are you talking about? It turns out that the frequency is 1786 GHz. And this is the frequency of infrared radiation. :))
You just mixed up the frequency with the counter there.
It's really 3.8e-07 seconds. That is about a third of a microsecond. Not much different from MQL.

Yes, that's right, I got it wrong.

 
Alexey Navoykov:

Yes, that's right, mixed up)

Although this is a real solution.
Checked it - their counter does not react to local time change.
So if I need microseconds and use them for long period of time then please useKernel32.dll
Thank you!

So this is still a bug, which for MQ is not difficult to fix.
 

We need to send collective requests to the service-desk. Because otherwise it's useless. They even stopped responding to compiler bugs. There are plenty of requests, but all to no avail.

In the same way, I ask them to create millisecond TimeLocal and TimeCurrent (especially the second one, because it's problematic to implement it by myself).

 
Konstantin:

There is a benefit, you can use it to offload the GUI, for example here:

Canvas class object for the whole chart, drawing data in tables, cluster data, levels, etc., if OnTimer is turned up to the maximum and place the GUI there (and I always do so), without time delay one chart loads my VPS about 45-60%, if you do a delay of 250, then everything is normalized to a minimum, the graphics responds to the buttons clearly, the system is not loaded

What is the connection between GetMicrosecondCount() and OnTimer() discussed here?
 
Alexey Navoykov:

Here is a variant using a high-resolution winapi timer, giving an accuracyof 3.8e-07 seconds.

That's how we count microseconds
 
Renat Fatkhullin:
This is how we count microseconds

Renat, can you fix binding to local time GetMicrosecondCount()?
Because the consequences can be very unpredictable for those who don't know this feature.




int OnInit()
  {
   EventSetMillisecondTimer(1000);
   return(INIT_SUCCEEDED);
  }
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   return(rates_total);
  }
void OnTimer()
  {
    Comment("Программа уже работает: "+(string)(round(double(GetMicrosecondCount())/1000000.0))+" сек");
  }
 
No, it is a relative timer for accurately measuring time intervals, not astronomical time.
 
Renat Fatkhullin:
No, it's a relative timer for precise measurement of time intervals, not astronomical time.

Thank you, I will know.
I was misled by the reference.

 
Renat Fatkhullin:
This is how we calculate microseconds.

Why don't we calculate GetTickCount in the same way? Then the problem of 15 ms resolution, which is causing problems, will disappear.

Reason: