Features of the mql5 language, subtleties and tricks - page 88
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Forum on trading, automated trading systems and trading strategies testing
Bugs, bugs, questions
fxsaber, 2016.07.19 12:41
On the example of ORDER_TICKET, the idea should be clear.
Forum on trading, automated trading systems and testing trading strategies
OrderCloseTime () in MQL5?
fxsaber, 2018.07.18 03:51
So we can check if the current history table, previously generated through HistorySelect-functions, contains the record we need. The same applies to DEAL_TICKET.
Forum on trading, automated trading systems and trading strategies testing
Save position price level through clearing (is it possible?)
fxsaber, 2018.07.17 20:45
Perhaps not everyone knows that the GetMicrosecondCount function, unlike GetTickCount, is tied to the local computer time, i.e. if this time changes (e.g. due to synchronization with Internet time), the GetMicrosecondCount values will also change by a corresponding value.This should be kept in mind if this function is used for measuring time intervals. As a matter of fact, you should not use it for such purposes. GetTickCount, on the other hand, does not have these problems.
As a demonstration, you can run this code and change the computer time while it is running.
Perhaps not everyone knows that the GetMicrosecondCount function, unlike GetTickCount, is tied to the local computer time.
I did not know that, thank you!
A variant of the GetTickCount function that excludes overflows (provided that the interval between function calls does not exceed 50 days)
Perhaps not everyone knows that the GetMicrosecondCount function, unlike GetTickCount, is tied to the local computer time, i.e. if this time changes (e.g. due to synchronization with Internet time), the GetMicrosecondCount values will also change by a corresponding value.This should be kept in mind if this function is used for measuring time intervals. As a matter of fact, you should not use it for such purposes. GetTickCount, on the other hand, does not have these problems.
As a demonstration, you can run such code and change the computer time while it is running.
Well, then it is a bug the developers should fix. Because then the function does not fit the description:
Функция GetMicrosecondCount() возвращает количество микросекунд, прошедших с момента начала работы MQL5-программы.
The value of this function compared to GetTickCount is microseconds, not milliseconds (1000 times higher accuracy). It's also non-inflatable.That's why it's not quite correct to speak about its substitutability.
Perhaps not everyone knows that the GetMicrosecondCount function, unlike GetTickCount, is tied to the local computer time, i.e. if this time changes (e.g. due to synchronization with Internet time), the GetMicrosecondCount values will also change by a corresponding value.This should be kept in mind if this function is used for measuring time intervals. As a matter of fact, you should not use it for such purposes. GetTickCount, on the other hand, does not have these problems.
As a demonstration, you can run this code and change the computer's time while it is running.
One more important observation: it follows from this that it is absolutely inappropriate to use the GetTickCount function instead of GetMicrosecondCount.
I think that will be a surprise for many people.
In examining the work of a simple script:
The result of the work:
we can draw the following conclusions:
Well then this is a bug, which the developers would do well to fix. Because then the function does not correspond to the description:
The value of this function compared to GetTickCount is microseconds, not milliseconds(1000 times more accurate). It's also non-inflateable.That's why it's not quite correct to talk about its substitutability.
If you measure execution time of some parts of the program, system performance fluctuations level out all this accuracy, and the error is on milliseconds or even tens of milliseconds. If you measure very small segments with duration less than 1 millisecond, then what's the point in it. The share of error in measurements will be very high.
I haven't seen any practical use of microseconds yet. If you measure the execution time of some program sections, then fluctuations in system performance level out all this accuracy, and the error there is in milliseconds, or even tens of milliseconds. If you measure very small segments of duration less than 1 millisecond, then what is the point. The share of error of measurements will be very high.
Another important observation, which implies that using the GetTickCount function instead of GetMicrosecondCount is absolutely inappropriate.
I think this will be a surprise for many programmers.
Examining the work of a simple script:
the following conclusions can be drawn:
The significant argument