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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X