to exchange data between indicators and charts.
All methods from that GlobalVariable indicator are static and I am using the IObserver pattern.
Here is my code structure :
Indicator 1 sends data to GlobalVariable :
ChartControl.Dispatcher.InvokeAsync((Action)(() =>
{
NinjaTrader.NinjaScript.Indicator.GlobalVariable.SetData(xxx);
}));
public void GetData(xxx)
Multiple markets and indicators use these class at the same time.
It works fine. Is this code structure makes sense or could be problematic.
On a few PC I get the following error : Attempted to read or write protected memory.
I have no way to know if it could come from that Global Variable pattern or from other code

The OP code does not extend the Indicator class. It extends a class, (or creates a new class), that inherits from Indicator, just like all other indicators.
Comment