MQL4: update function OrderClose to avoid compile warnings

This commit is contained in:
Viacheslav Demydiuk
2025-10-08 10:59:05 +03:00
parent a5b8e33611
commit 2c4d9b130b
2 changed files with 12 additions and 3 deletions
BIN
View File
Binary file not shown.
+11 -2
View File
@@ -3796,15 +3796,24 @@ bool OrderCloseAll()
if (OrderSelect(i, SELECT_BY_POS)) if (OrderSelect(i, SELECT_BY_POS))
{ {
int type = OrderType(); int type = OrderType();
bool order_closed = true;
switch(type) switch(type)
{ {
//Close opened long positions //Close opened long positions
case OP_BUY: OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red ); case OP_BUY:
{
order_closed = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
break; break;
}
//Close opened short positions //Close opened short positions
case OP_SELL: OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red ); case OP_SELL:
{
order_closed = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
break; break;
}
} }
if (order_closed == false)
Print("Failed to close order ", OrderTicket());
} }
} }