For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Purpose of adding multiple Strategies



  • I am aware this is probably a stupid question but still:
    What is the (main) purpose of adding multiple strategies to the mix?

    Is the purpose to have relations between strategies? E. g. strategy A only opens a position if strategy B has no positions currently?

    Or is it just for performance reasons? I could imagine that it is faster for backtrader to process multiple strategies using the same data once it has preloaded the data once anyway?
    So in the end it would be (semantically) the same as running the strategies one after the other in that case.


  • administrators

    It's not stupid. It's simply you haven't come across a use case that fits your profile. A potential use case would be a Strategy that only operates when a bullish condition is detected. The second one can act when a bearish condition is detected. In many cases they won't operate simultaneously, but there can be overlapping periods.

    Fully separating the filters that decide what's bullish and what's bearish and the associated logic for each one can help and will also let you assess the performance of each on a separate basis.



  • Thank you, that helped!

    Also I played around with it yesterday and found out (it's probably obvious to you guys) that multiple strategies can influence each other when running in parallel through the broker. When strategies are using the same broker (which is standard, I think), then broker related conditions (like current position) can influence the strategies.


  • administrators

    It is a single account broker!



  • @backtrader said in Purpose of adding multiple Strategies:

    A potential use case would be a Strategy that only operates when a bullish condition is detected. The second one can act when a bearish condition is detected. In many cases they won't operate simultaneously, but there can be overlapping periods.

    I would really like to assimilate this type of architecture in my project. but i'm not sure what is the best approach. I want to have different strategies for different market conditions, so i can analyze each one separately.

    • Backtrader doesn't support sub-strategies so how do we manage which strategy is getting executed on each given condition? (or do we just let each strategy check it's own condition regardless of other strategies, which sound really messy and inefficient)
    • how do we manage buy/sell orders when strategies does overlap? how do we notify the right strategy on any given change? how to prevent conflicting orders or duplicates?

  • administrators

    @jacob said in Purpose of adding multiple Strategies:

    • Backtrader doesn't support sub-strategies so how do we manage which strategy is getting executed on each given condition? (or do we just let each strategy check it's own condition regardless of other strategies, which sound really messy and inefficient)
    • how do we manage buy/sell orders when strategies does overlap? how do we notify the right strategy on any given change? how to prevent conflicting orders or duplicates?

    You create a communication channel for the strategies or a shared data structure that lets you control which strategy can operate and which cannot or if both have to be active or inactive.