،،،جرب الوظيفة التالية فقط،،،
كود:
void CloseMaxProfit()
{
int ticket;
double profit ;
for (int i =1 ;i<OrdersTotal();i++)
{
for (int x = OrdersTotal()-1;x>0;x--)
{
OrderSelect(x,SELECT_BY_POS);
if (OrderProfit() >= profit && OrderProfit()>0) ticket = OrderTicket();
}
OrderSelect(ticket,SELECT_BY_TICKET);
if (OrderType() == OP_BUY)
OrderClose(ticket,OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),NULL);
if (OrderType() == OP_SELL)
OrderClose(ticket,OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),NULL);
}
}