Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

HelpTeam: can you tell me what this error means doing a backtest?

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

    HelpTeam: can you tell me what this error means doing a backtest?

    I'm running several backtests and this is the first time in years that I see this error. Can you point a possible cause in order to address it?


    Unable to create instance of strategy 'NinjaTrader.Strategy.INFSbacktest'. Most likely the implementation no longer exists, or there is no default constructor defined, or the default constructor does not work correctly: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
    at NinjaTrader.Strategy.INFSbacktest..ctor()
    at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)​

    Thanks a lot

    #2
    Doing my own little user research, dealing with obvious "out of memory" , I realize that this error doesn't pop when I set a low -> "Keep best # results" in parameters. This never happened before, so I think I might need some software re-installation because of some unknown issues. What do you think?

    Comment


      #3
      Hello pstrusi,

      Thanks for your post.

      Yes, this error message "System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown." indicates that your system ran out of memory.

      What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)

      Are you running more than one optimization at a time in the Strategy Analyzer window?

      Does your strategy have 1-Tick intrabar granularity added to the script?

      We should consider the following for memory consumption:

      Data * Strategy resources * Number of optimization iterations * Number of trades * Keep best # of results.

      We can easily control the number of iterations involved and we can also consider writing our strategies to use IsInstantiatedOnEachOptimizationIteration = false; (Which requires that we reset class level variables in State.DataLoaded.)

      Further, reducing the 'Keep best # results' will also decrease the amount of memory used when running an optimization.

      IsInstantiatedOnEachOptimizationIteration — https://ninjatrader.com/support/help...niteration.htm
      Optimization Tips — https://ninjatrader.com/support/help...ionPerformance
      Walk Forward Optimization — https://ninjatrader.com/support/help...ss_metrics.htm
      Genetic Optimization — https://ninjatrader.com/support/help..._algorithm.htm​​​
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        Thanks Brandon for your comprehensive approach. Here some answers:

        - NT version -> 7.0.1000.43

        - Nope, just running one optimization at the time.

        - I use 1 tick or tick by tick in my models from a long time ago, never pops any issue.

        - This is a good tip that I didn't know !! --> "We can easily control the number of iterations involved and we can also consider writing our strategies to use IsInstantiatedOnEachOptimizationIteration = false; (Which requires that we reset class level variables in State.DataLoaded.)"

        - Yes, it makes sense what you say that the number of iterations consumes memory, still I could request a lot of it, and NT7 always delivered.



        Last one: I tried some of the links below that you put and it leads to "Web page not found".



        Thanks for your answer, I think now I might discard the reinstallation and rather tweaking some of your suggestions


        Comment


          #5
          Hello pstrusi,

          Thanks for your notes.

          I understand now that you are using NinjaTrader 7.

          The links in my previous post were for NinjaTrader 8, not NinjaTrader 7

          Note that IsInstantiatedOnEachOptimization is only available to use in NinjaTrader 8, not NinjaTrader 7. If you would like to take advantage of this feature then you would need to update to using NinjaTrader 8 instead of NinjaTrader 7. NinjaTrader 8 contains many new features and updates compared to NinjaTrader 7.

          Does the error message occur when running an optimization on the SampleMACrossover strategy that comes default with NinjaTrader?

          You can observe the Memory Usage in the Windows Task Manager to confirm if your machine is running out of memory when this error occurs. Please right-click on your Windows Task Bar and select Task Manager. Go to the Processes tab and locate the 'ninajtrader.exe' process.

          When you add a tick series you can quickly use up a lot of RAM.

          To prevent the System.OutOfMemoryException error message in NinjaTrader 7, you could reduce the amount of data that you are running an optimization on, reduce the 'Keep best # results' property, and apply the performance tips linked below.

          NT 7 Performance Tips: https://ninjatrader.com/support/help...ance_tips2.htm

          NT 7 Running an Optimization: https://ninjatrader.com/support/help...a_strategy.htm

          NT7 Walk-Forward Optimization: https://ninjatrader.com/support/help...e_a_strate.htm
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Yesterday, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X