• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimizer Freezes, even on Default

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Optimizer Freezes, even on Default

    Hi,

    Any tips for getting the Optimizer to complete a run without freezing? Do I have too many add-ons/assemblies? So far, the max iterations is about 200, then it just won't respond. Last Optimize froze at 218 out of 900 iterations, a 15 minute job. This seems to be the max for default/genetic on my computer, and I'd like to run longer jobs. What should I do>

    Thanks!

    #2
    Hello chinaexpert1a,

    Thank you for your post.

    The NinjaTrader optimization engine is optimized to take advantage of as much system resources as possible, and it is advisable not to trigger an optimization during a time where you would need to be using the PC. However, there are a number of ways in which you may be able to reduce your CPU and memory usage during an optimization run and avoid maxing out your resources and having NinjaTrader freeze up.

    I don't know how many parameters you are optimizing your strategy on, but strategies with a relatively large number of parameters for optimization can multiply the impact on your PC resources.

    When working with strategies with a large number of parameters, avoid using "1" as the increment value for the parameters, to avoid forcing the optimizer algorithm to run the maximum number of permutations. Changing the increment value to as little as "2" can cut the number of permutations in half.

    Also, you may want to try testing more using the Genetic algorithm instead of the Default. The default algorithm tests every single combination of parameters within the optimization range to find the best possible result. For more complicated optimizations this can take some time to complete, as you've seen. The Genetic algorithm, on the other hand, can be more useful for more extensive optimizations, because it doesn't test every combination - instead, it works on something similar to evolution via natural selection.

    Genetic optimization will find the approximate optimal solutions, but since it doesn't test every possible combination it's not guaranteed that the optimization would be the absolute best.

    Here's a link to our help guide that goes over Genetic optimization:

    https://ninjatrader.com/support/help..._algorithm.htm

    If this is a strategy you have coded yourself, there is also the IsInstantiatedOnEachOptimizationIteration property you can set in State == State.Configure.

    The default behavior of the Optimizer is to re-create the strategy for each optimization run. However, this process requires more time and computer resources to return results, which could impact the amount of time it takes to run an optimization.

    When this property is set to false, the strategy is re-used to save time and computer resources. When this is set to false, internal properties are reset to default values after each iteration, but it is possible that user-defined properties and other custom resources may carry their state over from the previous iteration into a new backtest run. To take advantage of performance optimizations, developers may need to reset class level variables in the strategy otherwise unexpected results can occur.

    You can find out more information regarding this property in our help guide link below:

    https://ninjatrader.com/support/help...niteration.htm

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      This was an excellent answer. Good post.

      I would like to utilize the instantiation property, but...I'm not at that level yet to be able to handle all of the points and I'm still learning Ninjascript.

      My question is, how do I get the Optimizer to handle more than 200 iterations without freezing/crashing? Other than this option. I like your tips. For instance a question I have is the linearity of results and outcomes imbetween optimization intervals, I would think most assume it according to the logic in play, but combination yield surprising results. Is there any wisdom here, or best practice? Would I better off starting an optimization, for instance on a double, with large intervals and then drilling down, seems reasonable right?

      I would like to suggest that next keep best # results, minimum metrics could be entered, that would make the whole tool and experience, take off.

      Or can I do this somehow with a Strategy>UnRealizedPnL term? Just thinking.

      Thanks so much Kate!

      Andrew

      Comment


        #4
        Hello chinaexpert1a,

        Thank you for your note.

        I would try with large intervals and drill down as you said. I'd also really suggest at least trying the IsInstantiatedOnEachOptimizationIteration - it's possible you may not need to reset the variables.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Ok I will try to figure that out as I progress through Ninjascript. Thanks! [email protected]> (ninja arrow)

          Comment


            #6
            You can read about the root cause of the problem here: https://ninjatrader.com/support/foru...53#post1095553
            There are ways to force garbage collection other than that only being very conservative with memory or clearing it by switching workspaces before optimization as a stop gap measure will help to some degree.
            Last edited by MojoJojo; 07-08-2020, 11:37 AM.

            Comment


              #7
              Thank you, MojoJojo...jo..jo..

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by catinabag, Today, 07:01 AM
              0 responses
              1 view
              0 likes
              Last Post catinabag  
              Started by asmmbillah, Today, 06:42 AM
              0 responses
              3 views
              0 likes
              Last Post asmmbillah  
              Started by digibob, 07-08-2020, 03:45 AM
              5 responses
              35 views
              0 likes
              Last Post johnnymustard  
              Started by kanavancbduk, Today, 01:21 AM
              0 responses
              7 views
              0 likes
              Last Post kanavancbduk  
              Started by yalmandraku, Today, 01:21 AM
              0 responses
              5 views
              0 likes
              Last Post yalmandraku  
              Working...
              X