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

4 hours of resample data



  • i am using 4 hours of resampledata

    data0 = DataFactory(
            dataname=args.symbol or "MSFT",
            timeframe=bt.TimeFrame.TFrame("Minutes"),
            fromdate=pd.Timestamp('2020-07-27'),
            todate=pd.Timestamp('2020-07-29'),
            compression=1,
            historical=True)
        cerebro.adddata(data0)
    
        cerebro.resampledata(data0, timeframe=bt.TimeFrame.Minutes, compression=60 * 4)
    

    and i am fetching 4 hours resample data in def init(self):
    like this

    self.data4h = self.datas[1]  # 240 minute resampled data
    

    its giving me error

    File "4hresample.py", line 74, in __init__
        self.data4h = self.datas[1]  # 240 minute resampled data
    IndexError: list index out of range
    


  • I wan not able to recreate your issue using regular data feed from csv file, second data feed was added and len(self.datas) returned 2. I would assume that the issue is connected to the DataFactory class.


Log in to reply
 

});