Get MAX lot size?

 

Can someone please help to get the MAX lot size? Lets say i have 4 opened orders

Lots Size 1
Lots Size 2
Lots Size 3
Lots Size 6

I am trying if some how my script can return "MAX lot Size" and put into a variable. ..

 

Here you go:

double maxLots;
for(int i = 0; i < OrdersTotal(); i++){
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   maxLots = MathMax(OrderLots(), maxLots);
}
 
Thank you so much