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

optimization on Strategy Selection example

  • Hi:

    The strategy selection shows an example of running two different strategy using the same cerebro.

    Is it possible to run the optimization of each of the strategy within_STRATS = [St0, St1]?

    For example, if I want to optimize strategy St0, sma2=bt.ind.SMA(period=[20,30,40]), and optimize St1: sma1 ma period [5,10].

    Is it possible to do that please?

  • administrators

    You then need to have 5 optimizations (the sample shows 2) and the StFetcher instantiating the appropriate strategy with the appropriate parameters. In the example idx is used as the key to decide which strategy to return. The same idx can be used to decide which strategy to instantiate and with which parameters.