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/

    problems when using cerebro.optstrategy

    General Discussion
    2
    2
    445
    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.
    • S
      soliu last edited by

      I am new to backtrader. I tried to use the the optimizer and changed the code from:
      cerebro.addstrategy(MyStrategy)
      To
      cerebro.addstrategy(MyStrategy)
      cerebro.optstrategy(
      MyStrategy,
      maperiod=range(10, 11))

      But after changing the code, it stuck at the step cerebro.run() after running the code. In the cmd windows, there are some print as below. I appricate it very much if someone could solve my issue.

      Starting Portfolio Value: 10000.00
      Starting Portfolio Value: 10000.00
      Starting Portfolio Value: 10000.00
      Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
      prepare(preparation_data)
      File "C:\Python27\lib\multiprocessing\forking.py", line 510, in prepare
      'parents_main', file, path_name, etc
      File "C:\Python27\Scripts\tu_back_trader\New_opt.py", line 103, in <module>
      cerebro.run()
      File "build\bdist.win32\egg\backtrader\cerebro.py", line 1142, in run
      File "C:\Python27\lib\multiprocessing_init_.py", line 232, in Pool
      return Pool(processes, initializer, initargs, maxtasksperchild)
      File "C:\Python27\lib\multiprocessing\pool.py", line 161, in init
      self._repopulate_pool()
      File "C:\Python27\lib\multiprocessing\pool.py", line 225, in _repopulate_pool
      w.start()
      File "C:\Python27\lib\multiprocessing\process.py", line 130, in start
      self._popen = Popen(self)

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        By the looks of it ... it could a problem with your Python installation. The error is deep in the stack.

        It could of course have to do with your code snippet, but the sample you post is too small to conclude anything.

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