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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    35 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    12 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    18 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X