I have noticed one strange thing -- NT seems to persist Instruments[], but not Inputs[]. At the very beginning they are both length 1 on entry to Initialize(), and length 3 on exit (after 2 Add() calls). On subsequent calls to Initialize() Instruments[] is length 3 (containing the things I Add()ed before), while Inputs[] is length 1. If I only do one Add() then on exit Instruments[] is still length 3, while Inputs[] is only length 2. I am guessing that this mismatch is what causes the problem.
In the error case, using Visual Studio shows that after Initialize() I never get called again -- OnStartup() never gets called in the error case.
Supporting my hypothesis that the problem is Add()ing fewer series, if I make the Advances and Declines cases do two Add()s -- adding an extra unneeded data series -- then all works just fine. Plotted values are correct. No hangs.
Does anyone know what is going on, or what I should do? Until I hear a better idea I'll just have to add an unwanted extra data series -- at least that works. Is this a NinjaTrader bug? It sure sounds like it to me.
One thought I have -- since I am going to do the correct number of Add()s, what if on entry to Initialize() I truncated Instruments[] to be the same length as Inputs[]? Sounds like worth a try. How do I truncate Instruments[]?
--EV
Comment