OrderSelect() does not select order that was just placed

 
Hello, I have a problem.

My EA places an order, then selects the order to get some information about it. It does this fine. Later (in the same cycle) the code will try to do something else with the order. It will execute the OrderSelect() again on the same order (because sometimes it may not already be selected).

The OrderSelect() is failing. It seems to fail if the order was already previously selected.

Can anyone verify if the following is true (maybe a bug?):

res=OrderSelect(myTicket,SELECT_BY_TICKET,MODE_TRADES);
// res==true
res=OrderSelect(myTicket,SELECT_BY_TICKET,MODE_TRADES);
// res==false



Is this true? Any other suggestions??

Thank you anyone for your feedback.

 
We have the same problem...

Last week Oct 29/30, it was working perfectly but somehow, its no longer works properly last Thursday.
 
My EA places an order, then selects the order to get some information about it. It does this fine. Later (in the same cycle) the code will try to do something else with the order. It will execute the OrderSelect() again on the same order (because sometimes it may not already be selected).

The OrderSelect() is failing. It seems to fail if the order was already previously selected.

Can anyone verify if the following is true (maybe a bug?):

res=OrderSelect(myTicket,SELECT_BY_TICKET,MODE_TRADES);
// res==true
res=OrderSelect(myTicket,SELECT_BY_TICKET,MODE_TRADES);
// res==false



Is this true? Any other suggestions??



Two consequitive calls to OrderSelect() work just fine.

Try
res = OrderSelect(myTicket, SELECT_BY_TICKET);
Print(res, " ", myTicket);

to make sure that you are selecting the same myTicket.

 
Thanks for your reply, but I have verified that the ticket number is correct by printing out information.

The OrderSelect() command is in a for() loop that selects a series of trades and changes the limit of each one. It fails to select ticket #200 (the order that was just placed and actually already selected in a prior function), but then it successfully selects tickets #199, #198, #197, #196. Each time it prints the ticket number of the successful or failed OrderSelect(), so I know it is not a ticket number problem.

Anybody else have any ideas? Thanks again.
 

look in official example code : MACD Sample.mq4


if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))

continue;


somehow it just happen on my back-testing until i saw the example code