https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=483933#Post483933

had same issues

in fact - I think my current script also immediately opens a trade.
but only one. so I sort of can ignore it for the price of single trade fees

try adding preload flag (my current script doesn't have it, think that's the issue), remove asset() function call, make sure you got history data already prepared

while debugging the issue - set lot size below minimum so your exchange would reject your trades and you don't lose money

I don't know precise reason this happens