@Rumen-Nenov said in Multiple Timeframes with Multiple Datafeeds:
For multiple datafeeds however, looks like backtrader includes both the 5 min and daily timeframes in same set of feeds (self.datas)
For a single data feed too. Each and every data feed is present in the self.datas
iterable, exactly in the order in which they were introduced in the system.
@Rumen-Nenov said in Multiple Timeframes with Multiple Datafeeds:
and from here on I cannot pass the data I want to the relevant indicators
And why not? They are data feeds, they can be passed to any indicator.
@Rumen-Nenov said in Multiple Timeframes with Multiple Datafeeds:
Not only this but the daily data also messes around with my intraday indicators.
Exactly how? This would be the first time.
@Rumen-Nenov said in Multiple Timeframes with Multiple Datafeeds:
for i, d1 in enumerate(self.data1):
Sorry but self.data1
is a data feed and not and array of data feeds. This is for sure not in the documentation. It seems you assume that daily data feeds get magically all packed inside self.data1
. No.
See here for what self.data1
means: Docs - Platform Concepts
What you need is to have a convention for the addition order of the data feeds to cerebro. If you add a 5-min
/ 1-day
data feeds per instrument, you can use something like for i in range(0, len(self.datas), 2)
, where self.datas[i]will have the
5-minfeed and
self.datas[i + 1]will have the
1-day` feed.