I am trying to get some code to work in C#. I took an indicator that was working, it displayed VolumeProfile Bid * Ask for each bar and plotted it, as well as plotted the difference. All is good. I then added some code to also plot some averages. To accomplish this, I added some plots, Variable series and instances of a few functions of average types to see which I liked. Now I get this null pointer issue, and have no idea where it is occurring. I have tried commenting out sections of code, and I have also stepped thru the VS2019 debugger. It steps through the entire set of code. It executes each line with CalcBar. The error happens on the closing curly brace of CalcBar. Any suggestions? I have attached both the working limited code as well as what I am trying to get to run.
Thanks in advance for any help?
JohnR in NC
Working limited code - no average logic or other setup for it.
JOR_Volume_Stats
if (vp != null)
{
plot_Ask_Vol.Set((double)_maxAsk);
plot_Bid_Vol.Set((double)_maxBid);
_bar_color = minusColor;
if (_deltaTotal > 0) _bar_color = plusColor;
Delta_Total.Set((double)_deltaTotal, _bar_color);
}
}
private void VolumeProfileOnEChanged(bool full)
{
//Recalculate if the profile has been completely changed.
if (full)
this.ExecControl.Recalculate();
}
}
}
This is the indicator that is not working and throws the exception.
JOR_Buy_Sell_Volume same code as above with additional plots, variable series and function instances.