Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Optstrategy and skipped combinations

    Indicators/Strategies/Analyzers
    1
    3
    188
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TullioTech
      TullioTech last edited by

      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

      1 Reply Last reply Reply Quote 0
      • TullioTech
        TullioTech last edited by

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

        opt_runs = self.cerebro.run(optreturn=True)
        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 combination..is correct?

        1 Reply Last reply Reply Quote 0
        • TullioTech
          TullioTech last edited by

          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!!!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors