I would just like to compare the current candle's volume with the previous candles volume to determine if the current candle's volume is greater than or less than the previous candle's volume.
If it is greater, I would like to plot the current candle's volume in a lighter shade of green and if it is less I would like to plot the current candle's color in a different darker color.
I am unsure how to alter (or add to) the Value[0] definition in the code to get the previous candle's volume numerical value for comparison and also how to alter the AddPlot line of code to still plot all the volume bars.
Any assistance would be greatly appreciated. Thank you.
Below is the Ninjatrader VOL indicator lines of code (in bold text) I am referring to:
public class VOL : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = Custom.Resource.NinjaScriptIndicatorDescriptionVOL ;
Name = Custom.Resource.NinjaScriptIndicatorNameVOL;
BarsRequiredToPlot = 0;
Calculate = Calculate.OnEachTick;
DrawOnPricePanel = false;
IsSuspendedWhileInactive = true;
AddPlot(new Stroke(Brushes.DodgerBlue, 2), PlotStyle.Bar, Custom.Resource.VOLVolume);
AddLine(Brushes.DarkGray, 0, Custom.Resource.NinjaScriptIndicatorZeroLine);
}
else if (State == State.Historical)
{
if (Calculate == Calculate.OnPriceChange)
{
Draw.TextFixed(this, "NinjaScriptInfo", string.Format(Custom.Resource.NinjaScriptOnPriceCh angeError, Name), TextPosition.BottomRight);
Log(string.Format(Custom.Resource.NinjaScriptOnPri ceChangeError, Name), LogLevel.Error);
}
}
}
protected override void OnBarUpdate()
{
Value[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
}
}

Comment