Set FACTORS also, and use the "Margin" variable (not "Lots") for adjusting the trade volume. This is an example of adjusting Margin to the account size:
//Margin for enterLong()
if(Train)
Lots = 1;
else if(OptimalFLong > 0) {
Lots = 1;
Margin = clamp(Balance * OptimalFLong * 0.1, 5, 1000);
} else
Lots = 0;
...
// Margin for enterShort()
if(Train)
Lots = 1;
else if(OptimalFShort > 0) {
Lots = 1;
Margin = clamp(Balance * OptimalFShort * 0.1, 5, 1000);
} else
Lots = 0;
Play with the factor 0.1. The higher it is, the higher is both the profit and the drawdown. Be aware that the annual return percentage always goes down when you reinvest profits, because the drawdowns are higher.