Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1850
![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
Guys, the problem here is normal...I had to deal with this
When processing on the server requotes and as a result there are no orders to close and there is no request to close again either, as there is no longer a condition to close at profit.
All my robots close according to the following principle: there is a signal to close, we gather all positions into an array and then it closes them in the loop until there is no "0" left.
It works flawlessly.
All my robots close according to the following principle: there is a signal to close, we collect all positions into an array, then it closes in a loop until there is "0" left
It works flawlessly.
We can do it this way too, but it seems to me to be easier through a flag, while the result is the same "it closes until there is no "0" left".
Although someone likes it that way, so wiggle))))
All my robots close according to the following principle: there is a signal to close, we collect all positions into an array, then it closes in a loop until there is "0" left
Works flawlessly.
Same thing. Signal to close = virtual limit which will be handled first in OnTick.
Otherwise requotes will be annoying. The more accurate the signal, the more "twitchy" the prices are.
All my robots close according to the following principle: there is a signal to close, we collect all positions into an array, then it closes in a loop until there is "0" left
Works flawlessly.
And some people say that one and the same position should not be closed by sending a closing request several times. Otherwise "the broker will banish". This is the first time I've heard that, frankly. Of course, if you make something like DDoS attack from OrderClose function... But it wouldn't work either, because all requests are first sent to the queue. And only then the terminal calmly sends them to server one by one at correct interval. Nevertheless, I wondered whether a ban is possible as a result of frequent OrderClose calls. But so far everyone only confirms that it is not. Except for Andrei of course.
In general, the correct way to close the grid is to collect positions in an array, sort them by lots, and then close them from a larger lot to a smaller one.
This only applies to real trading, in the Strategy Tester you don't have to do it. You can also use limiters, but the code is more complicated in this case.
In general, the correct way to close the grid is to collect positions in an array, sort them by lots, and then close them from a larger lot to a smaller one.
Well, this only applies to trading on the real account, for trading in the tester you don't have to do that either.
It depends on what lot with what profit. I think it's better to sort positions by profit. And first to close the most "fat"!
It depends on what lot with what profit... I think it's better to sort positions by profit. And close the fattest ones first!
No, the price change of 5 pips in a small lot will not affect you much, but even 1 pip in a large lot will make itself felt. That's why we should cover with a bigger lot