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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    57 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    78 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    41 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    101 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    61 views
    0 likes
    Last Post PaulMohn  
    Working...
    X