void Delete_Pending_Orders_Sub_Program() { for(int i=OrdersTotal()-1;i>=0;i--) { //trReq.symbol=Symbol(); trReq.order=OrderGetTicket(i); trReq.action=TRADE_ACTION_REMOVE; OrderSend(trReq,trRez); } }I strongly suggest you to check the returned value when you are using a function.
angevoyageur:
I strongly suggest you to check the returned value when you are using a function.
I strongly suggest you to check the returned value when you are using a function.
thank you ;
but also with this correction ; still does not work.
TIMisthebest:
So, what is the returned value of the OrderSend() function ? What is the value of trRez.retcode ?
thank you ;
but also with this correction ; still does not work.
Documentation on MQL5: Trade Functions / OrderSend
- www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
angevoyageur:
So, what is the returned value of the OrderSend() function ? What is the value of trRez.retcode ?
sorry,So, what is the returned value of the OrderSend() function ? What is the value of trRez.retcode ?
10009 |
TRADE_RETCODE_DONE |
Request completed |
angevoyageur:
You don't call your function ?
//Delete_Pending_Orders_Sub_Program();
:) sorry
thank you.
TIMisthebest:
sorry,
sorry,
10009 |
TRADE_RETCODE_DONE |
Request completed |
Please note that you have to initialize your structure, or you can also have some errors.
//--- Remove All Pending Orders MqlTradeRequest request={0}; MqlTradeResult result; for(int i=OrdersTotal()-1; i>=0; i--) { request.order=OrderGetTicket(i); request.action=TRADE_ACTION_REMOVE; bool isOk=OrderSend(request,result); if(!isOk || !(result.retcode==10008 || result.retcode==10009)) { Print("Remove pending order #",OrderGetTicket(i)," error #",result.retcode); } }
angevoyageur:
thank you.
hi mehrdad
void DeletePendingOrder(int magic, string sym ,ENUM_ORDER_TYPE type =ORDER_TYPE_BUY_LIMIT ) { long order_ticket; HistorySelect(0,TimeCurrent()); for (int i=OrdersTotal()-1;i>=0;i--) if (order_ticket=OrderGetTicket(i)) if (OrderGetInteger(ORDER_MAGIC) == magic && OrderGetString(ORDER_SYMBOL) == sym && OrderGetInteger(ORDER_TYPE) == type ) { MqlTradeResult result; MqlTradeRequest request; request.order=order_ticket; request.action=TRADE_ACTION_REMOVE; OrderSend(request,result); }
kourosh1347:
hi kourosh:
thank you.You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi;
can you please help to fix,
it's can not delete pending: