Last active
January 4, 2023 09:31
-
-
Save mamirjamali/0761f1298f8932acb522e4a3e9086abb to your computer and use it in GitHub Desktop.
MQL - Delete pending orders after 5 minutes
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 DeletePendingOrders() | |
{ | |
if (OrdersTotal() >= 1) | |
{ | |
if (OrderSelect(0, SELECT_BY_POS, MODE_TRADES)) | |
{ | |
if (OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT) | |
{ | |
if ((((TimeHour(OrderOpenTime())*60)+TimeMinute(OrderOpenTime())) - ((Hour()*60)+Minute()))>5) | |
{ | |
bool delorder = OrderDelete(OrderTicket(), clrWhite); | |
Print("Order Closed Beacuse pendeing order time passed"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment