When this issue only occurs in trade mode, then you can use this condition to calculate a different lot size

Code
if(is(TRADEMODE))
{
Lots = ...;//Lots in trade mode
}
else
{
Lots = ...;//Lots in train or test mode
}


Hope this helps.