Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issues with Indicators freezing NinjaTrader.

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

    Issues with Indicators freezing NinjaTrader.

    Hello,

    I'm looking for advice on how to improve the performance of my indicators. The issue I'm running into is locking up NinjaTrader especially during opens when markets are moving quickly. I've checked the logs and traces say the same thing as this: https://ninjatrader.com/support/foru...t-enough-quota

    I'm trying to figure out how I can prevent this from happening. My indicators are using data from multiple instruments and I have 3-4 copies of these indicators up at once. This means I'm pulling price change data from up to 12-15 contracts at a time and additionally I'm using OnMarketData for some aspects of it. I understand this is asking a lot, and if it were just slow I would be fine with that, but its freezing and the application has to be killed and reopened in order to resume, it never recovers.

    I can't post the actual code so I'll give a pseudocode version in case anyone can spot something I can do to avoid the message queue limitation error.

    Code:
    OnBarUpdate:
      if BarsInProgress != 0 return;
      if CurrentBar < Period return;
    
      use CurrentDayOHL to get opening price of each data series.
      use Closes[] to pull current prices of all data series
      perform arithmetic that includes multiplication, subtraction and addition. Nothing intense.
      output to value[0]
    
      if IsFirstTickOfBar:
        if value[0] > certain amount:
          PlotBrushes[0][0] = one color
        else
          PlotBrushes[0][0] = a different color
    
      another small section of arithmetic
      Draw.TextFixed() to display the results of that in top left
    
    OnMarketData:
      if update is bid or ask:
        store values in a fixed sized array, no memory allocation occurs.
    These are being computed on 1 minute candles and I've tried both per price change and per tick and both freeze eventually, usually during market open. Again, as a programmer by trade I will say if this were just running slow I'd be perfectly fine with it as we're asking a lot, but it's producing an error (out of quota like in the link before) in the trace logs and it's freezing the entire program. I'm not entirely confident that throwing more hardware at this will solve it so that's why I'm posting about it here to see if anyone has any advice.

    Thanks in advance,
    Andrew.

    #2
    Hi Andrew, thanks for writing in.

    It seems like it's graphic memory related (creating too many Brush objects). A test for that would be to remove any plotting or plot brush modification from a test version of the indicator and see if the same memory problem comes up. If you can confirm that, use OnRender instead of the provided plotting techniques.

    Kind regards,
    -ChrisL
    Last edited by NinjaTrader_ChrisL; 07-08-2021, 09:28 AM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    597 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    555 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X