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/

    Rerun backtests with different start dates

    Indicators/Strategies/Analyzers
    3
    4
    185
    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.
    • B
      brettelliot last edited by

      Hi,

      I'm testing asset allocations using decades of monthly data and I want to make sure the starting month doesn't have an outsized impact on the results. Is there a way to do that?

      The best idea i have so far is to create a strategy that takes a start date as a parameter and use optstrategy to pass that in for every different start date I want to test. Then the algo just wouldnt do anything before the start date. However that impacts the analyzers which consider the start date by the start of the data.

      Thoughts?

      Thanks,
      Brett

      D 1 Reply Last reply Reply Quote 0
      • D
        davidavr @brettelliot last edited by

        @brettelliot I would think the easiest way is to just pass start and end date arguments to data feed calls for each data set.

        data = btfeeds.GenericCSVData(
            dataname=filename,
            fromdate=start_date,
            todate=end_date,
            ...
        )
        
        B 1 Reply Last reply Reply Quote 0
        • B
          brettelliot @davidavr last edited by

          @davidavr I planned on using optstrategy which means the data feeds are loaded once before running the backtests.

          I guess i could skip using optstrategy and build my own loop that runs a single threaded backtest for each month. I might lose multithreads but I also don't have to adjust analyzers.

          Ill give it a shot!

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

            @brettelliot You can use python multiprocessing to run seperate backtest.

            RunBacktest.com

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