I have been wondering if it is possible to have a code where two opposites pending order can be deleted by one if the order becomes a market order.If possible can you help me write the codes.
- Problem Deleting pending order with time (MQL5)
- error 4108
- [ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3.
It can be done. Give it a shot and try to code it. If you run into snags me or somebody will help.
int PendingOrders(int Magic) //COUNTS PENDING ORDERS { int c=0; int total = OrdersTotal(); for (int i=total-1; i >=0; i--) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if (OrderMagicNumber()==Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP)) { c++; } } return(c); } int DeletePendingOrders(int Magic) //DEFINITION OF HOW TO DELETE THE PENDING ORDERS { if(PendingOrders(Magic)==1) for(int i=0; i<OrdersTotal(); i++) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderMagicNumber()==Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP)) { OrderDelete(OrderTicket()); } } return(0); }
jmca wrote >>
It can be done. Give it a shot and try to code it. If you run into snags me or somebody will help.
It can be done. Give it a shot and try to code it. If you run into snags me or somebody will help.
Did you see the text i sent to you in private,this is the code i want you to look into.I have attached the EA to this reply.Concerning the pending order delete,please let me clarified the whole situation.I want to open two opposite pending orders simultaneously for a symbol-one a buystop,the other a sell stop- such that if market price hit one and becomes a market order the other pending order should delete automatically and instantaneously.Thanks for your co-operation.
Files:
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