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/

    Data Resampling Creating Entry Delay

    General Code/Help
    2
    2
    377
    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
      aceben72 last edited by

      I have daily data in a csv file and all is working well.

      I used the following code to resample it to weekly data:

      data_resampled = cerebro.resampledata(
          dataname=data,
          timeframe=bt.TimeFrame.Weeks,
          compression=1)
      

      But I have noticed that there is now a 1 bar delay between 'Buy Create' and 'Buy Executed'. This was not happening on the daily data prior to adding the resampling.

      e.g. Weekly (resampled):
      2012-10-19, BUY CREATE, 3.00
      2012-11-02, BUY EXECUTED, Size: 10, Price: 2.93, Cost: 29.30, Comm 0.00

      So it has skipped the 2012-10-26 bar altogether and entered at the opening price of the next bar.

      This is happening on all buy signals.

      Why would this be occurring?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by backtrader

        Too little information to draw any meaningful conclusion. Some context code and sample data could really be helpful.

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