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

Strategy Analyzer/Optimizer Won't Run On Mac/Parallels

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

    Strategy Analyzer/Optimizer Won't Run On Mac/Parallels

    I'm trying to use the NT8 strategy analyzer optimizer on my MacBook Pro using parallels. I have Parallels set up to use all eight intel i9 (2.4 GHz) cores in the Mac along with all 32 GB of memory. However, the optimizer chokes on even a simple optimization problem. After I click run it starts optimizing but just gives up after two seconds with NO error message at all. And, there's nothing in the log.

    Can anyone shed light on what's happening or have any advice?

    Thanks for reading.

    Jeff

    #2
    Wait! I was looking in the wrong log file.

    Here's what the optimizer gave as an error:

    "Strategy 'My Strategy': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object."

    Any advice?

    Thanks

    Comment


      #3
      Hello Jeff,

      Thanks for your message.

      Object reference not set to an instance of an object means there is an object in your code that is null when it is being accessed.

      You can use debugging prints to identify the specific line that throws the error.

      Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

      Additional information on checking for null references can be found here - https://ninjatrader.com/support/help...references.htm

      Optimizations are inherently very resource intensive. This is by design. If your computer has all memory consumed, you will hit stalls for memory to be cleared. I have included some information that explains memory utilization in optimizations, as well as tips for running efficient optimizations below.

      Understanding Optimization Memory Utilization

      I have created a video demonstrating how the SampleMACrossover strategy, a simple strategy that utilizes IsInStantiatedOnEachOptimizationIteration=false for efficiency, can still quickly utilize memory resources.

      Demo — https://drive.google.com/file/d/15pz...w?usp=drivesdk

      We should consider the following for memory consumption:

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

      As we can see there are a number of factors that are involved and memory utilization can climb very quickly depending on a few of these factors. Once memory gets maxed out, we can experience short freezes where memory is decommitted, stored to disk, and then new resources are committed before the backtest is resumed.

      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.)

      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

      Please let us know if you have any additional questions.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by andrewtrades, Today, 04:57 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      6 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X