Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Memory Leak in Strategy Analyzer

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

    #31
    Hello gaz0001,

    Our development is aware of the behavior and working to find ways to improve the memory management.

    Putting this in as a bug report when the behavior is expected is not helpful to our development.

    To confirm, you have IncludeTradeHistoryInBacktest set to false, IsInstantiedOnEachOptimizationIteration set to false, and all variables are being instantiated or reset in State.DataLoaded, is this correct?

    Chelsea B.NinjaTrader Customer Service

    Comment


      #32
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello gaz0001,

      Our development is aware of the behavior and working to find ways to improve the memory management.

      Putting this in as a bug report when the behavior is expected is not helpful to our development.

      To confirm, you have IncludeTradeHistoryInBacktest set to false, IsInstantiedOnEachOptimizationIteration set to false, and all variables are being instantiated or reset in State.DataLoaded, is this correct?
      Hi Chelsea,

      Where is the button for these parameters?

      Comment


        #33
        Hello gaz0001,

        There is not a button for this.

        These have to be coded into the script. Any variables would need to be instantiated objects or the objects reset in State.DataLoaded.

        I am experiencing a memory leak in Strategy Analyzer while doing an optimization. It is reproducible during Safe Mode and using the Sample MA Crossover Strategy. It is reproducible according to your staff. The committed and working memory for ninjatrader.exe in resource monitor keeps climbing and climbing until it maxes out and


        Chelsea B.NinjaTrader Customer Service

        Comment


          #34
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello gaz0001,

          There is not a button for this.

          These have to be coded into the script. Any variables would need to be instantiated objects or the objects reset in State.DataLoaded.

          I am experiencing a memory leak in Strategy Analyzer while doing an optimization. It is reproducible during Safe Mode and using the Sample MA Crossover Strategy. It is reproducible according to your staff. The committed and working memory for ninjatrader.exe in resource monitor keeps climbing and climbing until it maxes out and


          https://ninjatrader.com/support/help...inbacktest.htm
          Thanks Chelsea, but I don't code. That's one of the reasons I was drawn to the NinjaTrader platform.

          I use the Wizard mainly.

          If these lines of code are essential for normal functionality of the strategy analyser, why aren't they implemented as default by NinjaTrader.

          Or a button at least for those that don't code themselves.

          Without adding these lines of code you can't run optimiser more than 5 times without crashing the platform.
          ​​​
          ​​
          ​​​​

          Comment


            #35
            Hello gaz0001,

            While I am not privy to the internal dialogue of the developers, I could see the lack of insight for coders causing an issue.

            Some variables may need to be reset in State.DataLoaded, or they will continue to hold their old value when a new optimization iteration starts which could cause the logic to go haywire.

            As we don't want an out of the box Strategy Builder script to produce unexpected results from the optimization to due a lack foresight by the builder, this is just not enabled by default. The script has to be unlocked and the coder would need to verify the script logic is developed properly to work with IsInstantiedOnEachOptimizationIteration being set to false.

            With IncludeTradeHistoryInBacktest, this can only be set to false if the SystemPerformance collection is not referenced in the code. So once again, the coder would need to verify the script is developed without this to prevent issues. This again requires that the coder unlock the script and review the code to make sure that won't be a problem.

            Further, we can't just release all memory after the optimization finishes because the optimization results are in memory and this is what is loading into the summary, analysis, and other displays when reviewing the iteration results.

            I am happy to send in a feature on this though.
            Last edited by NinjaTrader_ChelseaB; 11-09-2022, 08:29 AM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #36
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello gaz0001,

              While I am not privy to the internal dialogue of the developers, I could see the lack of insight for coders causing an issue.

              Some variables may need to be reset in State.DataLoaded, or they will continue to hold their old value when a new optimization iteration starts which could cause the logic to go haywire.

              As we don't want an out of the box Strategy Builder script to produce unexpected results from the optimization to due a lack foresight by the builder, this is just not enabled by default. The script has to be unlocked and the coder would need to verify the script logic is developed properly to work with IsInstantiedOnEachOptimizationIteration being set to false.

              With IncludeTradeHistoryInBacktest, this can only be set to false if the SystemPerformance collection is not referenced in the code. So once again, the coder would need to verify the script is developed without this to prevent issues. This again requires that the coder unlock the script and review the code to make sure that won't be a problem.

              Further, we can't just release all memory after the optimization finishes because the optimization results are in memory and this is what is loading into the summary, analysis, and other displays when reviewing the iteration results.

              I am happy to send in a feature on this though.
              I'd like to say I understand, but unfortunately I don't. :-)
              That's how I ended up forking out a couple of grand for fancy NT8 software to handle all this stuff for me.

              With regards to releasing the memory after optimisation. You said you cant just release it, which is cool.
              But how about a way to release it after the strategy analyser has been closed at least?
              Either by automatically releasing memory when the window closes, or a button?
              I mean, once I exit the Strategy Analyser, and then go back into it, I can't see the results of the old optimisations anyway. So why are they still hogging the RAM and the platform unnecessarily.

              I'm just looking for a way to use the platform without having to keep resetting it. Any workarounds or tricks for that?
              ​​​
              ​​​​​

              ​​​​​

              Comment


                #37
                Hello gaz0001,

                The only workaround would be unlocking the script and setting these properties and reviewing the code for any necessary changes.

                I can guide you through the process.

                Before unlocking the script answer the following:
                Does the script add any variables on the Inputs and Variables page?
                Does the script use the Strategy -> Realized PnL in any of the condition sets on the Conditions and Actions page?

                Then make a copy of the script in the Strategy Builder.
                Unlock the copy.

                Below is a link to a video.


                Find the section:
                Code:
                else if (State == State.Configure)
                {
                }
                In here add:
                Code:
                else if (State == State.Configure)
                {
                IsInstantiedOnEachOptimizationIteration = false;
                IncludeTradeHistoryInBacktest = false;
                }

                Chelsea B.NinjaTrader Customer Service

                Comment


                  #38
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello gaz0001,

                  The only workaround would be unlocking the script and setting these properties and reviewing the code for any necessary changes.

                  I can guide you through the process.

                  Before unlocking the script answer the following:
                  Does the script add any variables on the Inputs and Variables page?
                  Does the script use the Strategy -> Realized PnL in any of the condition sets on the Conditions and Actions page?

                  Then make a copy of the script in the Strategy Builder.
                  Unlock the copy.

                  Below is a link to a video.


                  Find the section:
                  Code:
                  else if (State == State.Configure)
                  {
                  }
                  In here add:
                  Code:
                  else if (State == State.Configure)
                  {
                  IsInstantiedOnEachOptimizationIteration = false;
                  IncludeTradeHistoryInBacktest = false;
                  }
                  Hi Chelsea B,

                  Thanks for the offer of the guidance and i do appreciate it, but honestly, i'm just not cut out for coding life.

                  Do you have a way to just release the memory and enable full system performance without me needing to restart the entire platform?

                  Comment


                    #39
                    Hello,

                    We can't just release all memory after the optimization finishes because the optimization results are in memory and this is what is loading into the summary, analysis, and other displays when reviewing the iteration results.

                    Meaning while it may be possible to run the garbage collection, it is not supported to do as it will cause undesired behavior, and not something the NinjaTrader Staff will advise.
                    This will also required much more advanced custom C# programming.

                    This thread will remain open if any community members would like to provide that information.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by poplagelu, Today, 05:00 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post poplagelu  
                    Started by fx.practic, 10-15-2013, 12:53 AM
                    5 responses
                    5,407 views
                    0 likes
                    Last Post Bidder
                    by Bidder
                     
                    Started by Shai Samuel, 07-02-2022, 02:46 PM
                    4 responses
                    98 views
                    0 likes
                    Last Post Bidder
                    by Bidder
                     
                    Started by DJ888, Yesterday, 10:57 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by MacDad, 02-25-2024, 11:48 PM
                    7 responses
                    160 views
                    0 likes
                    Last Post loganjarosz123  
                    Working...
                    X