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/

    execute against 2 (or more) different data sets

    General Code/Help
    2
    5
    1075
    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.
    • C
      cemdev last edited by

      I've loaded up 2 data files (2 different symbols).

      I want to run the same strategy on them both, but when i execute, only the first one actually gets executed, though they both get plotted. Not quite sure how to do this, or if i need to run them separately? I have 2 datafeeds, 1 strategy. I can run them separately, but it's faster if I can run them together and get the final $ result together.

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

        Sorry, but it really seems unclear what you want and without any code it seems the platform is doing what is requested to do.

        • You add 2 data feeds to the system
        • You get 2 data feeds in the strategy
        • You get 2 data feeds plotted

        So far so good.

        1 Reply Last reply Reply Quote 0
        • C
          cemdev last edited by

          okay, i see they get added as new data feeds, which makes sense. not what i wanted, but i'll just execute twice, no problem.

          1 Reply Last reply Reply Quote 0
          • C
            cemdev last edited by

            yes, all working. what i wanted was just to add 2 symbols and have the strategy execute against both of them (independently) - but I see how it's more flexible and powerful this way.

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

              The summary: you are trying to reuse a Cerebro for the execution of the same Strategy on different data sets.

              You need 2 execution runs and in each you add the appropriate data feed to the system. After run a cerebro instance holds all the strategies, datas, analyzers and indicators after they have come to the last point. The instance is not meant to run again with a different data feed.

              Create another cerebro instance (given it is the same strategy, a loop make sense)

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