Seeing how the data is actually resampled (what pandas gives you and what backtrader gives you) would seem relevant. Not only when buying and selling.
In addition to that and since the differences you see seem to be in the transition from 2015-03-13 to 2015-03-14, it would be ideal to see how the 1-minute bars around the transition look like.
backtrader gives you a resampled 1-day bar which is at the end of the day. The rationale behind:
If you mix that with a smaller timeframe, the 1-day bar is after the smaller timeframes.
pandas is giving you a resampled data at the beginning of the day. Now you mix 2 timeframes and:
2015-03-13 10:01:00 (1-minute timeframe) happens actually later than 2015-03-13 00:00:00 (1-day resampled by pandas)
Which wouldn't really make sense.
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.
Probably the fact that you see people compressing to 1, 2, 5, 10, 15, 20, 30, 45, 60, 120, 180, 240 and 360 minutes (haven't seen anything else). But even if I have seen people talking about 1, 2 hours ... never have I seen anyone talking about 6 hours (360 minutes)
Indeed nothing special
No, plotinfo is a property (which you declara as a dict, but which supports dot notation too) of lines objects like data feeds, indicators ...
mydata = bt.feeds.MyPreferredDatafeed(dataname='xxx')
mydata.plotinfo.plotlog = True
# not recognized kwargs will be passed to plotinfo
mydata = bt.feeds.MyPreferredDatafeed(dataname='xxx', plotlog=True)
mydata = bt.feeds.MyOwnLog(dataname='xxx')
You don't mention whether you're using backtrader to do real trading and want to round per exchange / currency rules, or just have more accurate simulations.
I actually wasn't able to get this to work in backtrader either, but honestly didn't try a whole lot on the simulation side. Rounding to 0.1 vs 1 if you're using simulated cash anyway isn't super meaningful. As Paska mentions, shifting up and down orders of magnitude could work but difficult (in my case, I simulated this by just increasing my starting cash by an order of magnitude instead -- e.g. if I'm trading LTC in increments of 0.1, I multiply my starting cash by 10 and divide the size of each trade by 10).
In my case, I am using backtrader to generate signals to automatically trade. At the time I generate the orders for the exchanges, I perform exchange / currency-appropriate rounding of the approximated orders generated from backtrader. For me, I'm allocating a percentage of my capital in the account for each trade, and then sizing the order based on current bid/ask prices. Since a lot of this is dynamic based on what is actually on the order book, spending a lot of time getting backtrader to exactly size the order seemed not really to be worth the effort in my case.
Not sure if this helps but thought I'd offer a suggestion.
@backtrader said in IndexError from Multiple Data Feed:
The Renko filter delays the delivery of the data, but the system tries to synchronize the multiple feeds, because some data is/was available.
You must be right. The strategy works with multiple data feed when there is no Renko filter. I guess I will just run this strategy separately for each data feed until there is a solution.
Yes the GenericCSVFeed opens the files itself.
You can subclass directly from CSVDataBase (as GenericCSVFeed does) and simply override _loadline
It is fully documented here: Docs - CSV Data Feed Development
It would be nice to have a description of the system you want to implement. At least if you are waiting an advice.
Built-in Highest and Lowest indicators calculates max/min prices for N last bars (rolling manner). Not sure why do you think other way.
Add daily data feed and apply your indicator to this data feed, it will give you daily values, they should be the same on all intraday bars of the day.
It could be adding NaN values itself ... we can't know. Easy way:
When you get to next in your indicator
print the len(self), so you'll know when it was first invoked
print the actual values being gathered by get(size=self.p.period)
That will for sure help you and in case that's not enough it will help the others see if they can help. The more the things you let others know the easier it will be.