Questions from Beginners MQL5 MT5 MetaTrader 5 - page 519
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
May I ask why this is done?
int total=OrdersTotal();
Because while the loop is running, the value ofOrdersTotal(); may change and you may miss an order or the loop body will glitch
Alexey Kozitsyn:
I want to add, if there are a lot of orders, at each iteration of the loop, thefunction will be called, and it's not economical.
Are you both joking or for real?
Alexey Kozitsyn:
I will add, if there are many orders,the function will be called at each iteration of the loop, and this is not economical.
Are you both joking or for real?
Alexey Kozitsyn:
У Вас другая точка зрения?
int i=OrdersTotal()-1
This action is executed once before the first iteration. There is no point in adding anything else. You just make the code larger.
in this design is possible, but in this design there is a chance of a glitch
In this design it is possible, but in this one there is a chance of a glitch
:)))))))
On what grounds?
А.
So always go over from the end.
In this case, yes. And in this case:
there is a difference. You didn't specify earlier what you meant.
:)))))))
On what grounds?
А.
So always go over from the end.
Yep, so it's just a matter of logic. I was more concerned that apart from the order of actions, you also have to take into account the update time of the data on the server.
I finally figured out what it was all about))))))))
As usual, ridiculously simple))
It's just a wrong application of pending orders) price went lower and the limit order with the buy price was higher))) It just couldn't be placed under those conditions)
Added "stop order" setting and voila, everything is as it should be))))
This method is not always suitable. For example, if you need to overshoot starting with the earliest order.