For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
self.cancel(self.order) does not work
-
Re: Problems with cancelling order
hello, I have met the same problem,can you give me some advice.
I have 3 orders,one market order , one stop order and one limit order, the stop order and the limit order will valid in 24 hours.
IF 15 hours later, the trade is closed,.at the same time,the market order and the limit order have been completed, but the stop order is not , so I want to cancel the stop order ,but the code " self.cancel(self.order)" is not work?self.order=self.buy() self.order=self.buy(exectype=bt.Order.Stop, price=self.datahigh+self.p.tiao, valid=self.data.datetime.datetime(0)+datetime.timedelta(hours=24)) self.order=self.buy(exectype=bt.Order.Limit, price=self.datalow+self.p.tiao, valid=self.data.datetime.datetime(0)+datetime.timedelta(hours=24)) if xxxx: self.order = self.close() self.cancel(self.order)
Also , I want to know what is the difference between the :
self.cancel(self.order) , self.broker.cancel(self.order)