![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
put a check on changing the order list
This way the re-indexing will not be accounted for.
It is clear that if they have been added, they or others will be missed. But what if they were just deleted? We won't be able to leave the order list?
So, there is nothing wrong with it - we will get an error during OrderSelect.
This way the re-indexing will not be taken into account.
That's OK - we'll get an error on OrderSelect.
1. What does indexing/reindexing mean? In my opinion, and flag it in the ... hands, because we'll start a new cycle. Or can you imagine the situation to be even more complicated? Can you imagine that it is possible to open one order and close another at the same time?
2. I agree. I'm not quite awake this morning... I'm not quite awake...
1. What is meant by indexing/re-indexing? In my opinion and flag in her ... hands, because we're starting a new cycle. Or can you imagine the situation to be even more complicated? Can you imagine that it is possible that one order will be opened and another one closed at the same time?
Yes, this could be one of the scenarios. There is one more variant
some pending order is executed during the cycle
What if during any cycle of working with orders, at each turn, we check if OrdersTotal() and OrdersHistoryTotal() have been changed?
And analyze these values depending on the situation?
Yes, one option could be this. There's also
1. This variant is on the verge of fiction. Well, in the end nothing will happen if it all goes back to normal on the next tick.
2. As I understand it, pending orders must be moved according to the algorithm and the stop will be moved to market orders. Consequently, the order type is checked and executed regardless of the time of execution.
What if during any cycle of working with orders, at each turn, we check if OrdersTotal() and OrdersHistoryTotal() have been changed?
And analyze the obtained values depending on the situation?
Here is a similar suggestion
Forum on trading, automated trading systems and strategy testing
Peculiarities of mql4, tips and tricks
Alexey Viktorov, 2017.09.15 07:24
Firstly, the situation is presented non-standard and few people have already solved this situation, if there are any at all.
Purely theoretically:
For OrderModify it is not necessary to organize reverse loop, so let it be direct.
And then we should check for changes in the list of orders
If the amount of orders has changed, let us start this loop anew with a new amount of orders.
There is also a question:
It is clear that if orders were added, they or others will be skipped. But what if they were simply deleted? We will not go beyond the order list?
Here was a similar suggestion
What if during any cycle of working with orders, at each turn, we check if OrdersTotal() and OrdersHistoryTotal() have been changed?
And analyze these values depending on the situation?
1. this option is on the verge of being a fantasy. Well, in the end, nothing will happen if everything falls into place on the next tick.
The next tick has become a gap. Why put off until tomorrow what can be done today?
2. As I understand it, according to the algorithm, the pending orders should be moved and the stop should be moved to market orders. Therefore, the order type is checked and executed regardless of the time of its execution.
Well, the order type cannot help in any way.
It may not be there when reindexing.
Then maybe we should try to select orders as quickly as possible (just select them!) and write them into an array, and then, in a separate function, check the availability of those orders + the necessary action (close/delete/modify)?
Although I don't think this branch is the best place to discuss it. This branch is for features.