I'm trying to plot values from previous bars within OnBarUpdate() however nothing is being plotted when I access bar values from previous bars:
Value[0] = High[1] - Low[1];
Value[0] = High[0] - Low[0];
Should this not plot the previous bars range? Or am I missing something?
public class PrevRange : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "PrevRange";
Calculate = Calculate.OnEachTick;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(new Stroke(Brushes.Orange, 2), PlotStyle.Bar, "PrevRangePlot");
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
[B]Value[0] = High[1] - Low[1];[/B]
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> PrevRangePlot
{
get { return Values[0]; }
}
#endregion
}
Chris

Comment