Features of the mql5 language, subtleties and tricks - page 191
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
Is it a bug or a chip that it throws this error?
C++ eats this quite well. And the arrays in MQL have their own arrays. So some std::array could be handled by this construct as well.
Is it a bug or a bug that it throws this error?
Not a bug. A template overload will only help.
Is there any way to quickly find out that there is no history for an instrument (either locally or on the server)?
Any CopyXXX request waits 30 seconds to retrieve the data, and it takes unreasonably long to go through a large number of instruments.
For some tools, it helps to check if there is a Bid (it's empty), but not for all tools.
You can check it on ICMarkets-MT5, toolWheat_U0
Is there any way to quickly find out that there is no history for an instrument (either locally or on the server)?
Any CopyXXX request waits 30 seconds to retrieve the data, and it takes unreasonably long to go through a large number of instruments.
For some tools, it helps to check if there is a Bid (it's empty), but not for all tools.
You may check it on ICMarkets-MT5, instrumentWheat_U0.
This has already been written about it many times and here is the first thing I've found https://www.mql5.com/ru/forum/285631/page35#comment_9431199
Alternatively these symbols have Ask and Bid == 0
Is there any way to quickly find out that there is no history for an instrument (either locally or on the server)?
Any CopyXXX request waits 30 seconds to retrieve the data, and it takes unreasonably long to go through a large number of instruments.
For some tools, it helps to check if there is a Bid (it's empty), but not for all tools.
You can check it on ICMarkets-MT5, instrumentWheat_U0
in the indicator will not wait for CopyXXX result
as an option in the timer in the indicator to process CopyXXX and call this indicator from EA
This has been written about more than once, and this is the first one I found https://www.mql5.com/ru/forum/285631/page35#comment_9431199
As a variant of these symbols Ask and Bid == 0
About zero Bid written at once, sometimes it's not zero.
in the indicator will not wait for the result of CopyXXX
an variant of timer in the indicator to process CopyXXX and call this indicator from EA
Now that's an idea! Thanks, I will try it.
The reason why this happens. After the first OrderSend, a market order appears and if a new tick comes before its execution, there is no position yet and the second OrderSend is made.
Because of this, a seemingly normal MT5 patternwill not work properly and as a consequence, most of the MT5 Expert Advisors in the codebase. At the same time the almost identical MT4 template will continue to work without any problems.
The seemingly good idea of PositionsTotal is somewhat overshadowed by the need in MT5 to also analyze OrdersTotal for market orders.
Be careful!
Thanks for pointing that out. I had it in mind. But now I've come to writing an Expert Advisor and I wondered if there is sense in checking requests sent to a server. Hypothetically, you've described it correctly, but in fact the server responds quickly to requests, and such a condition will not occur in most cases (99%, I think). But the speed of the algorithm will suffer every time. Which do you think is more important?
Enter the market once with 2 lots instead of 0.1, and the answer is immediately obvious )
Enter the market once with 2 lots instead of 0.1, and the answer is immediately obvious )
If you have an algorithm to conclude 0.1 lot, then there is a probability of 0.1 twice, and as I think this probability tends to zero, and three times, I think it 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?
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.