Anyone knows how to delete the pending orders in mt5?
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!"); } } }
luenbo:
Thanks for this you just saved me at least as much time as it took you to figure it out!
By reading the doc, I solved it myself,aha~
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.
Thanks Guys, this help me a lot.
Thanks! It has helped me also :)
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~