Lots, FreeMargin and AccountBalance

 

Lets immagine that our EA earn a lot. We want that when it will gain a 300% it will use only two thirds of the total amount. Doing so the EA put away a considerable amount of money that nothing can spend. But ... there is a but, I have to calculate a lot size for future position without the securized amount.

For doing it which is the correct formula ?

Lots = AccountFreeMargin() / 1000

or

Lots = (AccountFreeMargin() - SavedAmount)/1000

or ...

Anyone can explain to me the calculate for get number of Lot ?

Thanks