when creating a sell_bracket, backtrader fails with the following error:
File "../libs/backtrader/strategy.py", line 1218, in sell_bracket oret.append(olimit) NameError: global name 'oret' is not defined
self.ema = bt.indicators.EMA(self.datas, period=self.params.emaperiod)
self.macd = bt.indicators.EMA(self.datas, self.params.me1_period) - bt.indicators.EMA(self.datas, self.params.me2_period)
self.signal = bt.indicators.EMA(self.macd, self.params.signal_period)
change this to
self.ema = bt.indicators.EMA(self.datas, period=self.params.emaperiod) self.macd = bt.indicators.EMA(self.datas, period=self.params.me1_period) - bt.indicators.EMA(self.datas, period=self.params.me2_period) self.signal = bt.indicators.EMA(self.macd, period=self.params.signal_period)
the period value is missing in macd and signal
When filling an order which has a size for example of 1 with -1 will generate an division by zero Exception
File "../../libs/backtrader/order.py", line 199, in addbit self.price = (oldvalue + newvalue) / self.size ZeroDivisionError: float division by zero
i am trying to update exisiting orders when creating new orders. I am using oanda. When sending a new order, this may affect existing trades (tradesClosed, tradeReduced). Everything is working except setting the order to a size of zero, when it gets closed.
Is this a bug in backtrader or should i close trades in a different way?
@mula29 you need to install the btoandav20 package by yourself.
Either copy the folder btoandav20 into the example directory or
copy the folder btoandav20 into your python packages directory or
add the package path to your script:
import sys sys.path.insert(0, 'PATH_WHERE_btoandav20_IS_IN')
Hi, i did not check the following so it may be wrong, but it seems, the symbol is not available completely on quandl. i looked for the data here:
the data only has a close price, no other data available. backtrader will look for ohlc values i believe. There was a few months also some questions about quandl here in this forum with similar issues.
try to update to a recent version of backtrader or try to add a strategy.
The plot method will exit without a strategy before creating the mpyplot object, which is being tried to be shown in the show method later