Especially, when you run EA on hosted VMs with limited resources, it will cause execution delays and can even eat up the advantage you usually have from the hosted VM being so close to the broker server.
Trades never close because you specified those belonging to groups 1, 2 and 3 were to do it while all open ones belong to group 0. Simply remove those groups 1,2 and 3 from blocks 12, 27 and 42. On your lot size, it is weird because your logic is correct if those initial values are correctly selected.