Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Increase memory usage during Optimization for indicators with Draw

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

    Increase memory usage during Optimization for indicators with Draw

    Hey guys -

    I wanted to report an issue that I found.

    When you Optimize a strategy using an indicator with the Draw object, the Optimization/Strat Analyzer will consume all physical memory until the system slows to a crawl.

    I've attached a Test Script and a test indicator so you can see the problem. The script was built off the Sample MA Crossover with the only additions being the DM and DMArrow references. The DM Arrow indicator is simply the DM indicator with the Draw Arrow lines added.

    Steps to duplicate:
    1. In your test script, make sure the 2 DMArrow lines are commented out.
    2. For the Optimization settings, see attached graphic for what I used. I just wanted something large enough so you can see the memory usage within a few minutes.
    3. Start optimization. Open Task Manager and monitor the NJT exe memory usage. You can see that NJT will continually 'cleanup' its memory usage after a few minutes of running.
    4. Once you see the memory cleanup process happening, hit Abort.
    5. Edit the TestScript strategy and comment out the DM indicator and remove the comments from the 2 DMArrows lines. Compile.
    6. Run the optimization again and watch the resource utilization and notice that it doesn't cleanup. It just continues until you hit your max physical memory.
    7. Hit Abort when you're done looking.

    PS. While running this test, after you hit Abort before the test concludes, you may see the same error I reported a while back:

    Unhandled exception: Value does not fall within the expected range.

    This seems to occur when you Abort a large Optimization test. The error will keep occurring until you reboot your desktop. So, this is an additional error outside of the memory leak.
    Attached Files

    #2
    Thanks for the report PN720,

    I'm looking into the memory issue on my end and will write back after I have been able to fully analyze.

    I have not been able to reproduce the Unhandled Exception error yet. I'll include this note in a report, but if you are able to come up with similar steps to reproduce, it can help to lead the development team towards a fix.

    EDIT: I've done some profiling and I've created an internal ticket. The memory utilization looks to be expected due to the default garbage collection, but I am clarifying and also looking into the number of iterations that are completed.

    I'll keep you posted on my findings with this issue.
    Last edited by NinjaTrader_Jim; 09-12-2018, 08:17 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks for your patience PN720.

      QA has reported back that this performance impact is expected.

      Optimizations will run numerous iterations and can effectively create numerous drawing objects. The system will eventually run out of memory which effects performance and then we will have to wait for garbage collection to clean up before the backtest can continue.

      Generally speaking, drawing tools do carry a performance impact and drawing tools that are only used for visual purposes should not be used in optimization backtests.

      You may use some code like the example linked below to detect if you are running an optimization backtest and control using drawing tools in your script.



      We have not been able to reproduce the unhanded exception, so please let us know if this is still an on going issue that we should troubleshoot.
      JimNinjaTrader Customer Service

      Comment


        #4
        Hi Jim,

        Thanks for the confirmation about the memory leak. I'll just work around it by excluding the Draw objects when I do Optimizations.

        For that Unhandled Exception error, I'm still seeing it intermittently after an Optimization is complete. For example, today I just completed a Walk Forward Optimization and as soon as I clicked on the taskbar to switch windows back to the Control Center, I see the error. The Optimization was running on one of my custom strategies at the time. I switched to the Sample MA Crossover and still saw the error.

        I've reported this before and the error will only clear when I reboot. You can't just restart Ninjatrader as it returns anytime you want to switch NJT windows.

        Here's what the error looks like:

        Comment


          #5
          Hello PN720,

          I'd like to work with you closer on this matter through email. Could you send me a message to platformsupport [at] ninjatrader [dot] com with the text "Attn Jim" and a link to this thread?

          Thanks in advance, I look forward to troubleshooting this further.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          20 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
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          21 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X