Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom indicator causing memory issue during Optimization.

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

    Custom indicator causing memory issue during Optimization.

    I have a custom indicator that uses Draw.Rectangle when if finds a signal. I was optimizing a strategy that uses the indicator and I kept running out of memory. I memory profiled Ninjatrader during the Optimization and I was accumulating Rectangles and other GUI objects. To fix the problem I added a Debug property to the indicator and when I am optimizing I set it to false, so the indicator does not draw rectangles. This fixed the problem. I am wondering what is the BKM (best known method) for dealing with this sort of issue?

    Thanks,
    Erik

    #2
    Hello, thanks for writing in. You can use this code to determine if the script is running in the strategy analyzer in Optimization mode so you do not have to manually set a debug flag:
    Code:
     if(Optimizer != null && IsInStrategyAnalyzer)
    Print("in optimization");​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    151 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X