i need like this function

 

Hi,


i am beginner with mql5


i have this function in MQL4 

double get_Lot_from_last_ord(string SYM, int MAGIC)
{
   double LastLot=0;
   for(int i=OrdersHistoryTotal()-1; i>=0; i--)
   {
      if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
         if(OrderSymbol()==SYM && OrderMagicNumber()==MAGIC)   
         {
            if(OrderProfit()<0 )
            {
               LastLot=OrderLots();
            }
            break;
         }
   }
   return LastLot
}
        


and i need same function in MQL5


Thanks

 

Thank you  William Roeder 

it is very helpful .

Reason: