I have attached a basic - as basic as you can get - indicator that I'm using to try to get around another problem I'm having. I'm using AddVolumetric to get information that I would like to render.
My problem is the addition of AddVolumetric causes a crash in OnRender() for the call (that I got from here: https://ninjatrader.com/support/help...s/?gettime.htm:
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); // loop through only the rendered bars on the chart for(int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { // get the time stamp at the selected bar index value [COLOR="blue"]DateTime timeValue = Bars.GetTime(barIndex); // [B]This call crashes[/B] [/COLOR] Print("Bar #" + barIndex + " time stamp is " + timeValue); } }
It turns out, when BarsInProgress = 1, I get the crash with "Object reference not set to an instance of an object." And for what I want to render, I need to know if the bar is in a certain time parameter. The only way I know to get the bar time in OnRender is to call Bars.GetTime() which crashes if the Volumetric bars are loaded.
I can render my objects if I check for BarsInProgress = 0 but my objects go away when OnRender when BarsInProgress = (Volumetric bars), which means I'm seemingly kind of screwed.
Is there any other way to get that information?
Thanks!
Comment