Download MetaTrader 5

Anyone knows how to delete the pending orders in mt5?

To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
enbo lu
Moderator
1945
enbo lu 2012.08.05 16:26 

Anyone knows how to delete the pending orders in mt5?

first,select the pending orders you want to delete;

second, use OrderDelete() function to delete them.

but how to write this in mql5? 

can anyone help?

thanks a lot~ 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
enbo lu
Moderator
1945
enbo lu 2012.08.05 17:35  
luenbo:

Anyone knows how to delete the pending orders in mt5?

first,select the pending orders you want to delete;

second, use OrderDelete() function to delete them.

but how to write this in mql5? 

can anyone help?

thanks a lot~ 

 

 

By reading the doc, I solved it myself,aha~ 

void PendingOrderDelete() 
{  
         CTrade mytrade;
         int o_total=OrdersTotal();
         for(int j=o_total-1; j>=0; j--)
         {
            ulong o_ticket = OrderGetTicket(j);
            if(o_ticket != 0)
            {
             // delete the pending order
             mytrade.OrderDelete(o_ticket);
             Print("Pending order deleted sucessfully!");
          }
      }     
}
Jeremy Scott
8770
Jeremy Scott 2013.01.19 08:45  
luenbo:

By reading the doc, I solved it myself,aha~ 

void PendingOrderDelete() 
{  
         CTrade mytrade;
         int o_total=OrdersTotal();
         for(int j=o_total-1; j>=0; j--)
         {
            ulong o_ticket = OrderGetTicket(j);
            if(o_ticket != 0)
            {
             // delete the pending order
             mytrade.OrderDelete(o_ticket);
             Print("Pending order deleted sucessfully!");
          }
      }     
}
Thanks for this you just saved me at least as much time as it took you to figure it out! 
phi nuts
2184
phi nuts 2013.01.19 10:31  
Use mql5 search and search for pending in forum and you find plenty, one of them is this, but you have to read the whole topic.
To add comments, please log in or register