For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Order fill and size 0



  • When filling an order which has a size for example of 1 with -1 will generate an division by zero Exception

     File "../../libs/backtrader/order.py", line 199, in addbit
       self.price = (oldvalue + newvalue) / self.size
    ZeroDivisionError: float division by zero
    

    i am trying to update exisiting orders when creating new orders. I am using oanda. When sending a new order, this may affect existing trades (tradesClosed, tradeReduced). Everything is working except setting the order to a size of zero, when it gets closed.

    Is this a bug in backtrader or should i close trades in a different way?



  • Nevermind, it was some obscure error in my code.