You will need a loop searching for all open trades right now and check which one is having the higher lot size. Then store the ticket number of it and once the loop is completed, do the partial execution. How many open trades are supposed to be executed at the same time?
Y