Which design is correct? - page 2

 
PapaYozh:


It won't close.

If you don't believe me, do an experiment on a demo.

the problem may be the price is not normalised, everything else is true in the first option.
 
Techno:
the joint could be in the non-normalised price, everything else is true in the first option.


as soon as the zero order closes, all numbering will change and you will miss the next order.

As a last resort, you could do it this way:

  for (int i=0; i < Total; i++)
  {                                                                                          
    if( OrderSelect( 0, SELECT_BY_POS, MODE_TRADES ) )
 
PapaYozh:


As a last resort, you can go like this:


But it's better this way:

  for ( ; OrdersTotal()>0; )
  {                                                                                          
    if( OrderSelect( 0, SELECT_BY_POS, MODE_TRADES ) )
 
Techno:
the shoat may be in the non-normalised price, everything else is true in the first version.

requotes on the attempt - did not close.
 
requotes, missed order, well these are not such big mistakes, the main thing is that there is no dead zone, this 1 unclosed order will be closed on the second tick.
 
Techno:
The first one is basically correct, it will close all the orders, but we have to normalize the closing prices. The second fails, not all orders will close (the cycle is not correct)


And what does normalization have to do with it; in fact, the command to close the order is simply given here regardless of the prices?
 
valenok2003:


What does normalisation have to do with it, because the command to close the order is just that?
So you need to normalize it!!! You throw creations into the code base and you don't know such simple truths.
 
I'm sorry. Give me an example, please.
 
PapaYozh, both of these options are just for closing, but what about modification? I'd rather have 2 ticks for full processing than 2 different cycles for closing and modification
 
valenok2003:
I'm sorry. Give me an example, please.
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),5);
By the way, if you go over from the end, will there be a joint? It's not supposed to.
Reason: