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.
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.
Thanks in advance,
Andrew.

Comment