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

how to sum total size of buy/sell action. then displayed total size.



  • how to sum total size of buy/sell action. then displayed total size.

    using sizer() how i can count the size from the every order in program.
    Then display from self.log().
    Anyone have ideal?



  • If I understand what you want, you could:

    in ___init__() for the strategy initialize the total size attribute:

    self.totalSize = 0

    Then in notify_order() something like:

    if order.status in [order.Completed]:
        self.totalSize += abs(order.executed.size)
    

    abs() in case your going short as well


Log in to reply
 

});