I am hoping you can help me understand why this is not working reliably.
I wish to share some values between different indicators and charts as efficiently as possible, so without having to install the indicators again, so, I created an addon class with a public array of doubles. Now my indicators can reference that public double array and access the values. It works, mostly.
The issue is as follows.
I have the indicators on my charts and all is working perfectly. I add an indicator to another chart, and dispute it working fine across multiple other charts, this one fails to work. It cannot access the values - They are all returned as zeros. As if a new instance of the class has been loaded, or the variable was undeclared/unset.
I am accessing the array values as per the following example
NinjaTrader.NinjaScript.AddOns.myIndicatorScoring. shared_iScore[0,2]
I am both setting and reading the values in different indicators.
The array is simply declared in the addon as follows
public static double[,] shared_iScore = new double[20,20];
Most of the time, this is fine. Multiple writers and multiple readers are all getting the values fine. Sometimes, maybe just on a single chart as per today, it does not work, but a few refreshes of the chart, or charts (including the one setting the values perhaps), and maybe it starts working!
I'm a little confused as to why this might be. Could it be some sort of threading issue?
Any insight would be appreciated.
This has happened across multiple NT8 versions BTW - It's not a new thing. I am currently testing on latest released version. I suspect my method or understanding of how this should work in NT8 is flawed. Hoping you can steer me in the right direction.
Thanks.
Comment