Order of orders on OrderSelect

 

An issue made me question the following:


I have been using OrderSelect(<pos>,SELECT_BY_POS,MODE_TRADES), ASSUMING that such a select was returning the ORDERS in the same order in which they had been created. Some things are now leading me to question this reasoning.


IS it the created order that is returned? If not, what order is it? And is there a way to know between 2 orders which was created first, without using comments? I mean, the time is by seconds, so I'm guessing that won't help much....

 
IS it the created order that is returned? Yes.
And is there a way to know? By OrderOpenTime().
- You may also try OrderTicket() #.
- Ticket# unreliable broker change series.
- Orders are created one-at-a-time.
- There's usually at least 1_second between them.
- Don't use Comments as Brokers could overwrite them.
- When in doubt sort your own orders.
- Make sure you're not selecting from History.
- Make sure you're not selecting by Ticket.
- Make sure you loop is counting Down -- not ++.
 

Thanks! Well, if created order is what is returned then I must have done something mindboggingly obtuse to get a weird order.


Again, thanks!



ubzen:

IS it the created order that is returned? Yes.
And is there a way to know? By OrderOpenTime().
- You may also try OrderTicket() #.
- Ticket# unreliable broker change series.
- Orders are created one-at-a-time.
- There's usually at least 1_second between them.
- Don't use Comments as Brokers could overwrite them.
- When in doubt sort your own orders.
- Make sure you're not selecting from History.
- Make sure you're not selecting by Ticket.
- Make sure you loop is counting Down -- not ++.
 
Apagador: Thanks! Well, if created order is what is returned then I must have done something mindboggingly obtuse to get a weird order.
History is known to be out of sequence Order History sort by closing date - MQL4 forum
Reason: