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/

    How to optimize custom indicator parameters?

    Indicators/Strategies/Analyzers
    2
    4
    56
    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.
    • han shen
      han shen last edited by

      optstrategy can adjust the parameters in the strategy, how can I adjust the parameters in the previous section, Custom Indicators?

      C 1 Reply Last reply Reply Quote 0
      • C
        CDubya @han shen last edited by

        @han-shen

        I could not get optstrategy to work

        so I put the cerebro calls inside of a loop that varies the parameters I send to the
        addstrategy call.

        han shen 1 Reply Last reply Reply Quote 0
        • han shen
          han shen @CDubya last edited by

          @cdubya

          class Volume_Reversal_line(bt.Indicator):
              lines = ('Pr_chg','Std_100day','Avg5d_vol','Past_5d_avg_vol')
          
              params = (
                  ('period',12),
                  ('stdperiod',50)
              )
          
          

          I am referring to the parameters here. The parameters here cannot be adjusted with optstrategy.

          C 1 Reply Last reply Reply Quote 0
          • C
            CDubya @han shen last edited by

            @han-shen

            I would expect that you would have to pass the period,stdperiod values when in instantiate the class.

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