If possible, a software question

 
Hello
If possible, a software question
Now this function shows me the number of tickets to the largest loss
What is needed now is to know the deal number for the deal, which is less loss than the biggest loss

And thanks for the help




int Tick_A_L(int Type){
  int i,ticket=0;
  double max=0;
  RefreshRates();
  for(i=0;i<OrdersTotal();i++){
    if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){RefreshRates();return false;}
     if(OrderSymbol()==Symbol()&&OrderType()==Type&&OrderMagicNumber()==MagicNumber){
    if(OrderProfit()<max){max=OrderProfit();ticket=OrderTicket();}
  }
  }
  return(ticket);
}

 
Samir Arman:
Hello
If possible, a software question
Now this function shows me the number of tickets to the largest loss
What is needed now is to know the deal number for the deal, which is less loss than the biggest loss

And thanks for the help

OrderTicket() is MQL4 function, but "deal number" only exists in MQL5... so you're asking about MQL4 or MQL5?