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

Limit order with a day valid never gets executed? #220

  • Thanks for the detail explanation, after I set cash value, it works perfectly. Thanks again.

  • I had a similar problem and resolved by canceling the pending order every and then recreating it. This way there's no "weekend problem" when the order for next day is more than one day ahead.


    def next(self):
        if not self.position:
            self.order = = buy_price, exectype = bt.Order.Limit)
            self.order = self.close(price = sell_price, exectype = bt.Order.Limit)


Log in to reply