Backtrader Community

    • 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/

    Multiple Strategies with different start date

    General Code/Help
    2
    3
    115
    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.
    • L
      loris last edited by

      Hello @backtrader
      First of all thanks a lot for creating BT, what an amazing tool!

      I came across the following problem:

      Currently I have a strategy that I want to duplicate and have a portfolio of the same strategy but with different start dates.
      Strategy 1: Startdate 2013-01-01
      Strategy 2: Startdate 2013-02-01
      Strategy 3: Startdate 2013-03-01

      The strategy does a rebalancing each 3 months and I want with the different start dates that one of the 3 strategies does a rebalancing each month, because the holding period of 3 months is over.

      I also want a global money management that each strategy can trade with 1/3 of the capital. I can't figure out how I can do that.

      Would really appreciate if someone could help me with that, thanks a lot!

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

        There is a post which shows monthly rebalancing.

        • Here: https://www.backtrader.com/blog/2019-07-19-rebalancing-conservative/rebalancing-conservative/

        Strategies using 1/3 of the capital

        • The easiest way is to divide it at the time of the creation of cerebro and adding each Strategy
        • If not, strategies that are winning have to rebalance, using a maximum of the total net asset value, to free capital for the losing strategies. To avoid the inherent problem of sequential evaluation and that losing strategies could be looked at before, the sell orders have to be executed on a given day and the buy orders (with freed capital from the selling) on the next day.
        • The previous thing adds a problem which is that the data cannot be used with a monthly period because the next day would be the next evaluated bar, i.e.: the next month actually.

        Evaluating at the end of the month

        • Given that the gregorian calendar has months of different length, the best way is to use the first day seen of a month (which must not be 1 if it's a weekend or a bank holiday) and execute the rebalancing.

        • You simply need to keep a sentinel value keeping the last month (or None at the start) in which rebalancing was done and act when the month changes

        Different starting dates and 3-month period

        • Because you have 3 different dates and they are set 1 month apart, this is actually granted, because you won't receive data in your next until the 3 strategies deliver data.

        • The 1st time you will see data is on 2013-03-01 and you can use 3 as the sentinel for the last execution

        • When the date changes to April and with it to 4, you may execute the 1st rebalancing.

        L 1 Reply Last reply Reply Quote 1
        • L
          loris @backtrader last edited by

          @backtrader Thanks a lot for your answer and time! I will have a look at it.

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