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

Selling all positions



  • My algo currently makes multiple buys (self.buy()) but when a sell/stop is hit, the positions are sold separately at different times (using self.sell()). How can I sell all the open positions at once in one order?



  • @Ziyi-Liew maybe you can implement it by yourself,I don't know it has this function.But you can use a for-loop

    for data in self.datas:
         size=self.getposition(data).size
         if  size!=0:
             self.close(data)
    

    this for loop will close all your position.


Log in to reply
 

});