This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
Deleting specific ordersBack to topics list |
|
mpfx
2005.06.21 10:43
Greeting all,
The below code is meant to delete, for a specific symbol, a pending buystop order if the bid is less than open[0] or a sellstop order if the ask is greater than open[0] It does not work :( Anybody have an idea what is wrong .... Thanks total=OrdersTotal(); for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELLSTOP && OrderSymbol()==Symbol()) { if(OrderType()==OP_BUYSTOP) { if( Bid <= Open[0] ) OrderDelete( OrderTicket() ); return(0); } total=OrdersTotal(); for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELLSTOP && OrderSymbol()==Symbol()) { if(OrderType()==OP_SELLSTOP) { if( Ask >= Open[0] ) { OrderDelete( OrderTicket() ); return(0); } } } } } |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
