Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    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

    General Code/Help
    2
    2
    91
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mudassar031 last edited by

      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
      
      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        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.

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }