how do I Remove Closed orders from memory

 

Hello anyone,

I am having a problem in MT4 where I try to call OrderTicket() to determine the ticket number for any possible open orders.

the return from the OrderTicket() call is a ticket number from the last closed order.  I can see on the screen that that particular

ticket number has been closed and there is a newer open order with a subsequent higher ticket number.

 How do I identify the existing open order using code (mt4).  My intention is to use the ticket number to close the order if market conditions dictate.

 Thanks in advance.

 

--Peteloaf 

 
  1. You can NOT call OrderTicket() until you select a order with OrderSelect().
  2. Do a OrderSelect loop and find the open orders. See Loops and Closing or Deleting Orders - MQL4 forum
 
WHRoeder:
  1. You can NOT call OrderTicket() until you select a order with OrderSelect().
  2. Do a OrderSelect loop and find the open orders. See Loops and Closing or Deleting Orders - MQL4 forum
Thanks  WH  I am trying that now.   
Reason: