Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Optimization question . . .

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

    Strategy Analyzer Optimization question . . .

    I am running Strategy Analyzer Optimization (my computer has Quad Core CPU and 16 GB or RAM on Windows 10 Pro) and when I run this even on a small amount of data the results chug along and then
    I get down to the last three calculations and it seems to stall there for 10 - 15 minutes. Sometimes it never comes back and I have to kill the process which just means I have to rerun the
    scenario. Other times it does complete.

    Now it would sem to me that the whole purpose of this function is to be able to analyze multiple settings across multiple days to come up with optimal settings. However if it doesn't complete
    its not truly useful. And running it on a single days data does not provide useful results. It must be able to run through at least a months worth of data and complete.

    So my question is what can I do on my machine (besides choosing fewer days of data or fewer settings to optimize) to get these scenarios to complete? What are the requirements for a
    machine to run Strategy Analyzer in Optimization mode?

    #2
    Hello ATMtrader0001,

    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.

    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 as I'm sure you're aware.

    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.

    If your strategy draws a number of drawing objects on a chart as it runs, commenting these out when running a backtest or Optimization will improve performance dramatically.

    Also, you may want to try testing 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/helpGuides/nt8/genetic_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
      Kate,

      Thank you for the reply. I did go back and turn off all the drawing, but running what should be a relative small number of iterations still is
      problematic. I have one machine that was running an Optimization that had approximately 3600 iterations/tests which is not a lot and it
      runs through about 1/10th of them in a few minutes then stops responding altogether.

      Other times it goes through the same number of iterations in a few minutes. If I abort the test early enough then it will abort, the other times
      I have to kill the process. This is problematic.

      Comment


        #4
        Hello ATMtrader0001,

        Thank you for your reply.

        I'd suggest then if you haven't already to look into my suggestion of setting IsInstantiatedOnEachOptimizationIteration to true:

        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
        Have you tried experimenting with this property?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          I have looked at it, but haven't had the time to test side by side to see the results. And the Genetic setting does skip checking all permmutations of the strategy.

          I have a feeling that this is going to require a hardware upgrade and more time to test. I'll update next week, and thanks again for your sugggestiins.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          18 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          44 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          180 views
          0 likes
          Last Post jeronymite  
          Working...
          X