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

Optstrategy and skipped combinations

  • Hello

    I'm newbie about this framework, but I'm studing it with a lot of interest.
    I'm trying to do optimization of two or more parameters

    p1 = range(2, 8) #(2, 3, 4)
    p2 = range(9, 10) #(10, 12, 14)
    p3 = 2#range(2, 6) # (2, 3, 4)
    cerebro.optstrategy(StrategyIm, ema1period=p1, ema2period=p2, stddevmult=p3)

    and I noticed that cerebro doen't execute all parameters combinations. I need all results for plotting and doing my analisys outside cerebro.

    What I'm doing wrong?
    Thankyou for any idea

  • A bit more about the problem: Cerebro executes all the combinations. I can find it in the cycle after run:

    opt_runs =
    for run in opt_runs:
    for strategy in run:
    ema1period = strategy.params.ema1period
    ema2period = strategy.params.ema2period
    takeprofitmult = strategy.params.takeprofitmult
    stoplossmult = strategy.params.stoplossmult
    print('EMA1 Period' + str(ema1period) + 'EMA2 Period' + str(ema2period) + 'TAKEPROFIT MULT' + str(
    takeprofitmult)+ 'stoploss MULT' + str(stoplossmult))

    The problem is that the stop method of the strategy is not called for every parameter correct?

  • I did a workaround about my problem. I was interested in data which I found using analyzers. Of sure the best way to use backtrader!!!

Log in to reply