Skip to content

Instantly share code, notes, and snippets.

@currencysecrets
Created April 13, 2013 06:42
Show Gist options
  • Save currencysecrets/5377351 to your computer and use it in GitHub Desktop.
Save currencysecrets/5377351 to your computer and use it in GitHub Desktop.
This function returns the number of orders, both open or pending, for the currency and the type specified.
// this function will return the quantity of orders (both open and pending)
// on the selected currency for the order type requested.
int getQtyOrders( int type, string sym ) {
int result = 0;
int tot = OrdersTotal();
for ( int i = 0; i < tot; i++ ) {
if ( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) ) {
if ( OrderSymbol() == sym ) {
if ( OrderType() == type ) {
result += 1;
}
}
}
}
return( result );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment