You can see the problem in the error message: Your script closes a negative number of lots. Because you can not close negative lots, you'll get an error message.
Negative lots are either caused by a bug in the script or a wrong parameter stored in Assets.dta. For finding out what it is, just run the Tradetest script with the same asset on a demo account - if that works fine, it's something in your script.