Hi all,
I am running backtests with multiple feeds (multiple stocks all USA market). So am following recommended approach: sudo code
for stock in stockiist:
data = load corresponding csv file into Pandas dataframe
cerebro.adddata(data)
Then in next func of strategy:
for stock in self.datas:
do whatever
And that is working well for me. However, now I need to use Fibonnaci pivot point indicator which requires monthly data. According to this documentation
https://www.backtrader.com/docu/data-multitimeframe/data-multitimeframe/
I will need to add resampled line after adding the data, something like this
for stock in stockiist:
data = load corresponding csv file into Pandas dataframe
cerebro.adddata(data) #Daily sampled data
cerebro.resampledata(data,bt.TimeFrame.Months)
My understanding is that now self.datas will have the following:
"stock1 daily line, stock1 monthly line, stock2 daily line, stock2 monthly line, ..etc
Which is not convenient to iterate through in next function of strategy.
I wonder if there is a way to have monthly data added to another feed (other than self.datas) so in next function will have daily data fetched from self.datas and monthly data fetched from this additional feed.
The documentation here
https://www.backtrader.com/docu/data-resampling/data-resampling/
States that
"backtrader has built-in support for resampling by passing the original data through a filter object. Although there are several ways to achieve this, a straightforward interface exists to achieve this"
The straightforward it is referring to is to add "cerebro.adddata(data)" but nothing is said about other approaches. Would appreciate if anybody has done this and can provide help
Thanks