Max position size

Viewing 7 posts - 1 through 7 (of 7 total)
  • #72107

    Hey!

    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? 🙂

    #72116

    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.

    #72137

    thanks for the reply, can i backtest with cumulate orders max 2 or 3 somehow? so i can see what to expect?

    because sometimes the strategy did 5 orders and gave a big drawdown, and i want it to take max 2 trades for example, and see it in backtest 🙂

    #72138

    Sure, just set cumulateorders=true and then put an if condition in front of your order to only execute if countofposition<3 or what you desire.

    #72141

    i put “BUY if countofposition<3 and in backtest, it still buys more than 3 in a row, why?

    #72143

    Impossible to say without seeing your code.

    #72164

    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.

Viewing 7 posts - 1 through 7 (of 7 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login