execute against 2 (or more) different data sets



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


  • administrators

    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.



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



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


  • administrators

    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)


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.