How can i get last position's lot size

 

Dears,

How can I get all position's lot size

Here's my code:

for(int i = 0; i < PositionsTotal(); i++) {
      bool select = PositionSelect(PositionGetSymbol(i));
      if( select ) {
         double lot = PositionGetDouble(POSITION_VOLUME);
         Print("lot: ", lot);
      }
    }

But this double lot variable return first position's lot.