Created
April 17, 2013 01:40
-
-
Save currencysecrets/5401139 to your computer and use it in GitHub Desktop.
Removing pending orders when they do not match the new trading system's version number. It does assume that the system tag is placed in the OrderComment area of a new order.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void removeOldOrders( string sym, string systemTag ) { | |
int tot = OrdersTotal(); | |
for( int i = 0; i < tot; i++ ) { | |
if ( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) ) { | |
if ( OrderSymbol() == sym ) { | |
if ( OrderType() != OP_BUY || OrderType() != OP_SELL ) { | |
if ( OrderComment() != systemTag ) { // don't forget your new order must contain the systemTag! | |
OrderDelete( OrderTicket() ); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment