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/

    Backtest accuracy

    General Code/Help
    2
    2
    96
    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.
    • edge7
      edge7 last edited by

      Hi,

      I am new here, so please be nice to me :)

      I have been trying backtester for a week now and trying to understand the best way to use it.
      I have data from 5minutes to 1Day.
      If I want to test my strategy on a daily basis, it is probably better to still use 5 minutes data, in order to have better accuracy when matching the orders?
      Something like this:

      data = btfeeds.GenericCSVData(
                      dataname=d[1],
                      headers=True,
                      name=d[0],
                      fromdate=datetime.datetime(2010, 1, 1),
                      todate=datetime.datetime(2017, 1, 1),
                      timeframe=bt.TimeFrame.Minutes, compression=5,
                      nullvalue=float(NaN),
                      plot=False,
      
                      dtformat='%Y-%m-%d %H:%M:%S',
      
                      datetime=4,
                      high=1,
                      low=2,
                      open=3,
                      close=0,
                      volume=-1,
                      openinterest=-1
                  )
      
                  cerebro.adddata(data)
                  cerebro.resampledata(data,
                                       timeframe=bt.TimeFrame.Days,
                                       compression=1)
      

      Am I right?

      Thanks

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

        @edge7 said in Backtest accuracy:

        Am I right?

        Of course. Targeting 5-min bars is going to give a lot more accuracy than targeting 1-day 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(); }); }