The great and terrible MT4 forever (or how to strategise a transition) - page 12

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
It would be great to get around this point at MT4Orders level.
Order backups are happening now, unfortunately. Most likely because of this.
https://www.mql5.com/ru/forum/93352/page40#comment_13943845 it?
https://www.mql5.com/ru/forum/93352/page40#comment_13943845 it?
Unfortunately, backtracking happens with this crutch as well.
I don't know which way to debug anymore.
Unfortunately, backtracking happens with this crutch too.
I don't know which way to debug anymore.
Here's the reason (not that there aren't others).
P.6 is the most unpleasant. How to bypass this MT5 bug - haven't figured it out.
Here's the reason (not that there aren't others).
P.6. is the most unpleasant. How to work around this MT5 bug - haven't figured it out.
The check for "missing" orders would work here. But it would not work.
I must have messed up something.
A missing order check would work here. It doesn't work.
I must have done something wrong myself.
In point 7. "The missing order shows up, but there's still no position.
In point 7. The "missing" is found, but the position is still missing.
Does it mean that the loop on MT4Orders::OrdersTotal() will not see either the order or the position?
I thought this point was solved: either the order/position is in the list, or the order is "missing". How can a third thing happen?
Does this mean that the MT4Orders::OrdersTotal() loop will not see either order or position?
In all points, except point 6 and point 7, it shows that one position is visible.
I thought this point was just solved: either the order/position is in the list, or the order is "missing". How can there be a third?
Imagine that your EA reaches position 6 without knowing anything about the fact that there was an order. In that case there is no way for him to know that the situation corresponds to the missing order.
Imagine that your EA gets to point 6 without knowing anything about there being an order. In that case there is no way for him to know that the situation corresponds to the missing order.
I cannot imagine such a situation if limits are used at some distance from the price (not in the spread).
He will always have time to see the set order in the list. And subsequently the order will either become "missing", or it will turn into a position.
I admit that such a situation is possible if another EA has thrown an order at the current price and it immediately started to fill (point 6).
But that still doesn't explain why the first EA stops seeing its order (with its magician) in the list of MT4Orders::OrdersTotal().
It was surprisingly easy to reproduce the situation on the live EA - at the moment one of the orders was executed, the EA lost sight of the other one as well.
But when trying to build a simple example for reproduction, everything works fine. It looks like I really made a bug somewhere in the wilds of my code.
Here is from the documentation:
"the order in which these transactions arrive in the terminal is not guaranteed, so you cannot base your trading algorithm on waiting for some trade transactions to arrive after others have arrived. " https://www.mql5.com/ru/docs/event_handlers/ontradetransaction
And from experience, TRADE_TRANSACTION_ORDER_DELETE, TRADE_TRANSACTION_DEAL_ADD, TRADE_TRANSACTION_HISTORY_ADD transactions can arrive in any order.
Hence we have situations where there is no deal or order in the history yet, but the order already exists. Or vice versa, the order is still there, but the deal has already been executed. But the situation where the order is simultaneously in the active and in the history is hardly possible.
Actually, this is the reason why we refused to use the CTrade class - it has all these pitfalls.
The way to fight this problem is that each EA keeps a list of its orders and monitors their state. Including "non-standard" states - "order sent but not yet in working order" (here they can double up) or "order deleted but not yet in history". It also helps to work on the same symbol at the same time when netting.