Skip to content

Instantly share code, notes, and snippets.

@notmii
Created November 20, 2015 03:16
Show Gist options
  • Save notmii/58252a5746bc85694d7b to your computer and use it in GitHub Desktop.
Save notmii/58252a5746bc85694d7b to your computer and use it in GitHub Desktop.
void closeAllOpen() {
int total = OrdersTotal();
for(int i; i < total; i++) {
OrderSelect(0, SELECT_BY_POS);
int ticketNumber = OrderTicket();
double price = OrderType() == OP_BUY ? Bid : Ask;
OrderClose(ticketNumber, OrderLots(), price, 3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment