Delete All Pending Orders

Back to topics list  | 1 2 3 To post a new topic, please log in or register
avatar
Moderator
3206
angevoyageur 2015.02.20 00:12 #
 
d.saravana21:

This is for who's going to see this post new ;) ;) ;)

use this script. works well


No need to repeat 4 times the same code :

switch(type)
  {
   case OP_BUYLIMIT:    // Delete limit buy positions      
   case OP_SELLLIMIT:   // Delete limit sell positions
   case OP_BUYSTOP:     // Delete stop buy positions
   case OP_SELLSTOP:    //Delete stop sell positions
      result=OrderDelete(OrderTicket()); break;
  }
avatar
2017
gooly 2015.02.20 08:36 #
 

and what about this one-liner?:

if ( type > OP_SELL ) result=OrderDelete(OrderTicket());
 
avatar
1211
deysmacro 2015.02.20 08:52 #
 
gooly:

and what about this one-liner?:

Yes. Use that one. Fast and straight forward.
avatar
13001
WHRoeder 2015.02.20 13:48 #
 
gooly: and what about this one-liner?:
if ( type > OP_SELL ) result=OrderDelete(OrderTicket());
Or self-documenting code
if ( isPending(OrderType()) ) result=OrderDelete(OrderTicket());
:
bool isPending(int ot){ return !isMarket(ot);             }
bool isMarket(int ot){ return ot==OP_BUY || or==OP_SELL;  }

avatar
2017
gooly 2015.02.20 16:03 #
 

Or self-documenting:

#define IsPendingOrder(type) ((type)>OP_SELL)
...
if ( IsPendingOrder(type) ) result=OrderDelete(OrderTicket());


Back to topics list   | 1 2 3  

To add comments, please log in or register