Can you help ?
Here is what i am doing:
I have this class wide variable defined which holds a collection of indicators on the chart:
private List<NinjaTrader.Gui.NinjaScript.IndicatorRenderBa se> indicatorCollection;
In a method i have this code
============================
// define the variable which will hold a ref. to an underlying indicator on the chart
NinjaTrader.Gui.NinjaScript.IndicatorRenderBase _indicator;
// get an indicator from the collection
_indicator = indicatorCollection[i];
// loop through all the plots created by this indicator
int _plotsCount = _indicator.Values.Length;
for (int _plotIndex = 0; _plotIndex < _plotsCount ; _plotIndex++)
{
int _lastBarPainted = ChartBars.ToIndex - (_indicator.Calculate == Calculate.OnBarClose ? 1:0);
Plot _plot = _indicator.Plots[_plotIndex];
BrushSeries _plotBrushes = _indicator.PlotBrushes[_plotIndex];
Brush _plotColor = _plotBrushes[_lastBarPainted];
}
Print(_plot.Name + " " + _plotColor); // <- i always get an empty content for the _plotColor variable
There is no script error and the indicator name is displayed in the output window but the _plotColor is empty and i can't understand what's wrong in my code.
Comment