half size close

 
Dear Sir, I know how to open a trade by using ordersend() function now. After I execute 5 such orders, I have 5 open orders. If each time I open 2 lots, I would have 10 lots totally. At this moment, how can I close half my size --- that’s 5 lots? Are there any function to do that? Regards,
 
You must to close 2 orders with 2 lots and one order with 1 lot (half size of this order).