If i got defparam = false, and i got my bot to take a few trades in a row before selling, and i put the max position size to lets say 2, before i start the bot.
after the bot bought 2, and it wants to buy again, does it shut down? or will it keep running, until the 1 or 2 is sold, to be able to buy again? 🙂
Defparam = false will give you an error. I assume that you mean cumulate orders = false. If this is false your strategy will only buy 1 time (in one direction) as long as you don’t try to buy more than 2 contracts. The strategy will not stop but simply ignore all orders.
I don’t know if you found your bug, but I remembered that countofposition will return a negative value for short positions. Having abs(countofposition<3) in the if-loop will fix this. Without this addition the strategy will accumulate short positions without stop.