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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    77 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X