Features of the mql5 language, subtleties and tricks - page 192
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
From statistics: about 200-300 trades a day. Even with normal checks, but without any really tricky checks, on average 2-3 times a week I caught a double lot opening. Calculate probability and assess whether you need or are ready to accept such probability. Personally, I've made my checks to the max.
Thanks. And what is your ping?
It jumps in the 55-60ms range. But it's not about the ping. As I said, it's even with normal checks. This is where the wait was already, just adequate, like wait 1 second. But that's where it was flying out even for ranges that exceed the ping by orders of magnitude.
P.S. Interesting test for phantom orders in the subject https://www.mql5.com/ru/forum/1111/page2220#comment_7834585If you have an algorithm to make 0.1 lots, then there is a probability of making 0.1 twice, and as I think this probability tends to zero, and three times, I think is impossible. Let alone 20 times. After all, we're talking about application stuff. As a rule of thumb, the server responds probably in the limit of 10minsec (is that right? I'm not sure). How high is the probability of grabbing a second transaction, in your opinion? Do you do this check yourself? Does it happen that the server may take a long time to respond?
The response from the server with the transaction result can be delayed for very different reasons, and you can't count on 10ms in any case (even if the ping is 1ms)
Of course I do this check. More precisely, I use the ready MT4Orders which takes this (and many other things) into account.
Is this different behaviour from C++ a feature or a bug?
in the indicator will not wait for the result of CopyXXX
as an option in the timer in the indicator to process CopyXXX and call this indicator from EA
It worked, thanks for the idea!
How summer/winter time change can break MT5-Tester.
The easiest way to explain the problem is with an example. There is a symbol with these restrictions on quote sessions.
However, in the price history there are prices after 22:15 to 23:15. These are valid prices despite going outside the quote session.
The fact is that before the switch to winter time, the session was: 03:00 - 23:15. The explanation is easy. The trading server changes the time, but the quote symbol does not. For example, the index. Due to that, the trading server changes the session time for the corresponding symbol.
This circumstance leads to very unpleasant consequences in the MT5-Tester. You cannot trade at valid prices between 22:15-23:15 and get a rejection in the form of [Market closed]. I.e. the trade was really going on there, but the Tester does not allow you to do so.
In fact, the Tester distorts the trade by giving knowingly false results. It is quite problematic to notice this peculiarity. To fix the situation you need to correct the session time yourself.
Forget about this problem (and some others), you can switch to a custom symbol, which automatically calculates/writes the appropriate session times.
On the top screenshot of the symbol settings, there is a bottom line "Use time limit". Perhaps when it takes effect, you can still work around this problem through it.
For now the rule is valid - custom symbols can increase significantly the probability of the MT5 Tester's results being correct.
Remember, when you make requests for the price history (CopyRates/CopyTicks) in the terminal, do not focus on quote sessions.
How summer/winter time change can break MT5-Tester.
Thanks for sharing interesting observations - I also raised the time issue earlier, but I noticed incorrect markup in the future when the price on the bars is less than 0.
This question arises, are there any situations where it is correct to prohibit trading in the tester at all, or at least where there is a quotation of an instrument with a prohibition to trade on it in reality at certain hours? I understand that there are different indices, and it is not clear how to count profit on them, but in this case you can count it forcibly in points and just write a message in the log that the instrument is not traded, but you can check the TS.
there are quotations for an instrument with a prohibition to trade on it in reality during certain hours?
The first minute after midnight is banned. When it may be important, I put a check.
When there are several sessions in a day, I do not check it.
The first minute after midnight is off-limits. When it may be important, I check it.
I do not check if there are several sessions in a day.
This is an artificial situation created by brokerage companies. Suppose there are trades on a closed auction, but they are quoted.
This is an artificial situation created by the DC, but are there any real examples? Let's say there are trades in a closed auction and yet they are quoted.
Absolutely all the rules are artificial.