For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Cerebro Stop Error
-
Hi,
My cerebro run did not complete and exited with the following error.
The error message does not help much to troubleshoot the issue.
Anyone has encounter this before?
Thanks.
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in 5 cerebro.addstrategy(StrategyA) ----> 6 cerebro.run(exactbars=200) ~/Library/Python/3.7/lib/python/site-packages/backtrader/cerebro.py in run(self, **kwargs) 1125 # let's skip process "spawning" 1126 for iterstrat in iterstrats: -> 1127 runstrat = self.runstrategies(iterstrat) 1128 self.runstrats.append(runstrat) 1129 if self._dooptimize: ~/Library/Python/3.7/lib/python/site-packages/backtrader/cerebro.py in runstrategies(self, iterstrat, predata) 1299 1300 for strat in runstrats: -> 1301 strat._stop() 1302 1303 self._broker.stop() ~/Library/Python/3.7/lib/python/site-packages/backtrader/strategy.py in _stop(self) 481 482 def _stop(self): --> 483 self.stop() 484 485 for analyzer in itertools.chain(self.analyzers, self._slave_analyzers): TypeError: 'SellOrder' object is not callable
-
@hyperex said in Cerebro Stop Error:
acktrader/strategy.py in _stop(self)
Sure. Could you include all of the code from your strategy class?
-
Thanks.
I found the issue. I was assigning the stop order from bracket order into self.stop.self.order, self.stop, self.limit = self.buy_bracket(size=self.p.order_size, exectype=bt.Order.Limit, price=self.data.high[-1] + self.p.order_lvl_buffer, stopprice=self.p.stopprice, limitprice=self.p.limitprice)