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/

    Bug resampling oandav20 from 15m to 4h

    General Code/Help
    2
    3
    30
    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.
    • A
      ahoyahoy last edited by

      I'm using oandav20 and resampling from 15m up to 4h and the 1D. The problem is in 4h chart data I see non-aligned bars and it looks like the time axis is broken:

      eur_usd_EUR_USD_4h copy.png

      I've tried various combinations of the bar2edge and rightedge and adjbartime flags but still has the problem. I've also tried shifting the sessionstart but the daily chart needs this to be at 23 (aligning with broker time).

      When I search through the data dump (using the writer) I see extra bars coming out of the resampling aligning to the yellow arrows:

      2020-05-14 00:00:00
      2020-05-14 04:00:00
      2020-05-14 08:00:00
      2020-05-14 12:00:00
      2020-05-14 13:45:00. <-- what?
      2020-05-14 16:00:00
      2020-05-14 20:00:00
      ...
      
      2020-05-19 04:00:00
      2020-05-19 08:00:00
      2020-05-19 11:15:00 <-- what?
      2020-05-19 12:00:00
      

      any pointer appreciated, I've been a coder for 15 years so hit me with the hardcore detail if needed

      Here's my setup, if this is of help. Cheers

      datakwargs = dict(
          timeframe=bt.TimeFrame.Minutes,
          compression=15,
          stream_timeout=60,
          historical=args.historical,
          fromdate=fromdate,
          tz=args.timezone,
          backfill_start=True,
          backfill=True,
          sessionstart=datetime.time(23, 00), #oanda uses singapore time so 23 in BST.
          sessionend=datetime.time(23, 00)
      )
      
      rekwargs4h = dict(
          timeframe=bt.TimeFrame.Minutes, compression=240,
          bar2edge=False, 
          adjbartime=False,
          rightedge=False,
          takelate=False
      )
      
      rekwargs1d = dict(
          timeframe=bt.TimeFrame.Days, compression=1,
          bar2edge=False, 
          adjbartime=False, 
          rightedge=False,
          takelate=False
      )
      
      #Loop through the list adding to cerebro.
      for i in range(len(datalist)):
          data = DataFactory(dataname=datalist[i], **datakwargs)
          # enabling this seems to break daily graph
          cerebro.resampledata(data, name=datalist[i], timeframe=datakwargs['timeframe'], compression=datakwargs['compression'])
              
          cerebro.resampledata(data, name=datalist[i], **rekwargs4h)
          
          # day
          cerebro.resampledata(data, name=datalist[i], **rekwargs1d)
         
      config = dict()
      
      1 Reply Last reply Reply Quote 0
      • D
        dasch last edited by

        see https://community.backtrader.com/topic/2571/bug-resampling-oandav20-from-15m-to-4h

        1 Reply Last reply Reply Quote 0
        • D
          dasch last edited by

          sorry: https://community.backtrader.com/topic/2570/oandav20-resampling-from-15m-to-4h-shows-extra-bars/

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