For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Help with referencing multiple data feeds



  • Hi,

    I have been looking everywhere but I don't understand how to reference the data feeds i am looking for.

    e.g. I have 2 data feeds:

    cerebro.adddata(data)
    cerebro.resampledata(data,
                         timeframe=bt.TimeFrame.Minutes,
                         compression=60
                         )
    

    the first data in adddata is minute data and the resampled is hourly.

    I want to now be able to refer to the data in my strategy as

    self.minute.close[0]
    self.hourly.close[0]
    

    is this possible?



  • Are you possibly looking for something like replay?



  • you can refer to your data feeds inside the strategy as

    self.datas[0].close[0] # minute data feed
    self.datas[1].close[0] # hour data feed
    

    or

    self.data0.close[0] # minute data feed
    self.data1.close[0] # hour data feed
    


  • I managed to do this and it seems to work:

            self.minutes = self.data0
            self.hours = self.data1
    

Log in to reply
 

});