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/

    Optimization leads to worse results than random picking of parameters

    General Code/Help
    2
    4
    93
    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.
    • Z
      zuj last edited by

      I am trying to optimize my algorithm. But after optimizing, I ended up with worse outcome than randomly selecting some parameters.
      So, I thought that I should have done something wrong in selecting the optimal value from the results of cerebro.run() but then I checked the values and the code is working exactly the way I want it to.
      I am trying to optimize based on return/Drawdown ratio and select the parameters which have the highest value of this ratio among all the optimization runs. But when I checked I found that it was a global maxima =11.0 and around it were values like 1.1, 0.2, 1.4, 6.5(this was just before 11.0) and mostly values around 1. So, I am thinking that this is not actual the optimal value; just a fluke of numbers.
      So, my question is, how do I find optimal values among these hundreds of ratios?

      1 Reply Last reply Reply Quote 0
      • hghhgghdf dfdf
        hghhgghdf dfdf last edited by

        Export your backtesting data to excel and analyze if over there

        Having all results lined up makes it plain as day if a parameter combination is the result of dumb luck or alpha

        https://i.imgur.com/N7ZTd8f.png

        Z 1 Reply Last reply Reply Quote 1
        • Z
          zuj @hghhgghdf dfdf last edited by

          @hghhgghdf-dfdf I understand that this is a possibility but I have automated the optimization process and can't manually select the optimized parameters. There must be some logic to select the optimized parameters or otherwise I won't be able to code it.

          hghhgghdf dfdf 1 Reply Last reply Reply Quote 0
          • hghhgghdf dfdf
            hghhgghdf dfdf @zuj last edited by

            @zuj

            You could for each variable, average the return for each parameter and then select the best performing parameter out of that selection

            e.g.:
            a1729161-bc5d-4a6f-8151-04ba796f8b3c-image.png

            Alternatively, you could include the neighboring parameters as part of the selection process. (fitness value of period=10 is the average of the fitness values of period 8-12)

            Many possible solutions.

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