![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
PapaYozh, both these options are only for closing, but what about modification? Better to have2 ticks for full processing than 2 different loops for closing and modification?
If something has to be closed and something has to be modified, then the construction for (i=0; i<OrderTotals(); i++) is all the more incorrect.
We have to move from OrdersTotal()-1 to 0.
i.e. is this the correct design?
However, I still don't understand the normalisation.
It is one thing if I calculate the price, then it is clear that it must be brought to the digits of the terminal.
But in this case, we are closing at the current price obtained from the flow and, of course, it cannot be longer than Digits.
But here it is also closing at the current price derived from the flow, which of course cannot be longer than Digits.
However, I still don't understand the normalisation.
It is one thing if I calculate the price, then it is clear that it must be brought to the digits of the terminal.
But in this case, we are closing at the current price obtained from the flow and, of course, it cannot be longer than Digits.
Sometimes when Digits=4 Bid can be 1.32343545654 this happens. Not often, but it happens.
Live and learn. Thank you.
i.e. would this design be correct?
Not really: there is no check for the "symbol" of the instrument. If the orders will be open for more than one instrument, then you risk closing the orders of one instrument at the prices of the other. If you need to close the order of the symbol, on whose chart the Expert Advisor has been moved, then you have to use the "symbol" of the chart. If you need to close all orders, no matter what chart the EA is moved to, you have to read the "symbol" of the order and request to use the Ask and Bids of the appropriate "symbol". And there are unnecessary actions in the code.
Good luck.
i.e. is this the correct design?
Yes and there are extra actions in the code.
then there is an extra variable here for code transparency.
Or maybe you are talking about something else?
Sometimes at Digits=4 Bid may be equal to 1.32343545654. Not often, but it happens.
However, in the example of the close .mq4 script (in the standard MT4 delivery), there is no normalization.