|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I think I may have found the problem thanks to the thread "Need help" by Antone - need to test it, if anyone can confirm this may work
:Code:
for(int z=OrdersTotal()-1;z>=0;z--)
{
OrderSelect(z, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
OrderSelect(z, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if (OrderType()==OP_SELLSTOP)
{
OrderSelect(z, SELECT_BY_POS, MODE_TRADES);
OrderDelete(OrderTicket(),DarkGoldenrod);
return(0);
}//if sellstop
// else Print("Failed due to error ",GetLastError());
}//if symbol
}//if buy
}//if symbol
if(OrderSymbol()==Symbol())
{
if (OrderType()==OP_SELL)
{
OrderSelect(z, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUYSTOP)
{
OrderSelect(z, SELECT_BY_POS, MODE_TRADES);
OrderDelete(OrderTicket(),DarkGoldenrod);
return(0);
}//if buystop
// else Print("Failed due to error ",GetLastError());
}//if symbol
}//if sell
}//if symbol
}//end loop
|
|
||||
|
You'll need to scan the orders twice: first to discover whether or not there is the OP_BUY or OP_SELL trades that you want should cause canceling of pending orders. The second loop is to carry out the canceling. Something like the following:
PHP Code:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MT4 pending orders | fx_geezer | Metatrader 4 | 5 | 06-15-2007 09:36 PM |
| modify orders and close pending orders | bkgridley | Questions | 8 | 05-23-2007 09:49 PM |
| Closing Pending Orders | bkgridley | Expert Advisors - Metatrader 4 | 1 | 05-11-2007 05:47 AM |
| how to delete a pending orders | Altern8 | Metatrader 4 | 1 | 01-02-2006 02:10 PM |
| Pending orders | TheExponential | Questions | 4 | 11-25-2005 12:36 AM |