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/

    Possible to change 4-hr bar start time?

    General Code/Help
    2
    2
    116
    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.
    • Y
      you last edited by

      Hi,

      I am working on a BT strategy trading HSI Futures using IB aaa broker. Is there a way that I can have one hour bar from IB resampled to 4 hours bar and also adjust the start time of the 1st bar of the day to 9:00am instead of from 8:00?

      With trading hours of HSI futures: 9:15 am - 12:00 noon, 1:00 pm - 4:30 pm & 5:15 pm - 3:00 am.

      If I can adjust the 1st 4-hr bar to start at 9:00 then I can have the full day separated into 4-hr sessions with 9:00-12:59, 13:00-16:59, 17:00-20:59, 21:00-00:59, 01:00-04:59.

      Thanks

      run-out 1 Reply Last reply Reply Quote 0
      • run-out
        run-out @you last edited by

        @you Normally one would use boundoff as follows:

           cerebro.resampledata(
                    data, timeframe=bt.TimeFrame.Minutes, compression=240, boundoff=180
                )
        

        But sadly when I try to execute this in IB if doesn't work.

        RunBacktest.com

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors