Optimization - Sequence multiple combination of parameters
I know how to perform an optimization with backtrader. Let us say that I have a strategy with 2 parameters param1 and param2. The standard way of defining an optimization is done via (for instance)
cerebro.optstrategy(TradingTheCurveStrategy, param1 = range(1,10) , param2 = [3,6,9])
when calling optstrategy() will compute all the combination (product operation) of param1 and param2 and add them to the strategies to be backtested during the optimization process.
My question is as follows: Is there a simple way for me to specify exactly which combination of these 2 parameters I want to test. It can be useful when for instance, there is a relationship between these 2 parameters (some combination do not make sense) and we want to shorten the time of the optimization.
Thanks in advance
rangeis an iterator (not really, but let's assume it is). You can create your own iterators for
param2and let them cooperate. When
iterator_param2can only return
Or you can use the "Strategy Selection" pattern and decide upon strategy instantiation which combination of parameters is valid and which one isn't.
@backtrader I'll try this. Good input, thanks a lot
@lampalork following @backtrader advise, i have tried the strategy selection pattern. it works great in my case. thanks! For ease of reference: https://www.backtrader.com/blog/posts/2016-10-29-strategy-selection/strategy-selection/