I cannot figure out how an indicator can plot for historical bars but never plot again after it is added. If I right click and Reload Ninjascript at any time it will plot up to that point in time but after that, it will not plot again. Please help!
public class SpoofFinder : Indicator
{
private NetVolDelta NetVolDelta1;
private NinjaTrader.NinjaScript.Indicators.CSI.DeltaTickLine DeltaTickLine1;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Looks for Spoofs near swing highs and lows.";
Name = "Spoof Finder";
Calculate = Calculate.OnEachTick;
IsOverlay = true;
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 = false;
MinUpDelta = 15 ;
MinDnDelta = -15 ;
OffsetTicks = 5;
NumTicksfromHighLow = 7;
NumBarsSwingHighLow = 20;
AddPlot(new Stroke(Brushes.Red, 8), PlotStyle.TriangleDown, "Plot0");
AddPlot(new Stroke(Brushes.Lime, 8), PlotStyle.TriangleUp, "Plot1");
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
NetVolDelta1 = NetVolDelta(Close);
DeltaTickLine1 = DeltaTickLine(Close);
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < NumBarsSwingHighLow || CurrentBar < BarsRequiredToPlot)
return;
if (IsFirstTickOfBar)
{
int highestBarsAgo = HighestBar(High, NumBarsSwingHighLow);
int lowestBar = LowestBar(Low, NumBarsSwingHighLow);
double highestPrice = High[highestBarsAgo];
double lowestPrice = Low[lowestBar];
double SwingHigh = High[1] + (NumTicksfromHighLow * TickSize);
double SwingLow = Low[1] - (NumTicksfromHighLow * TickSize);
if (SwingHigh >= highestPrice)
{
if (Close[1] > Open[1] && // Price UP
DeltaTickLine1.DeltaClose[2] > DeltaTickLine1.DeltaClose[1] && // Tick Delta DOWN
NetVolDelta1.Buys[1] < MinDnDelta) // Vol Delta DOWN
{
Values[0][1] = (High[1] + (OffsetTicks * TickSize));
Print(string.Format("Down Arrow"));
}
}
if (SwingLow <= lowestPrice)
{
if (Open[1] > Close[1] && // Price DOWN
DeltaTickLine1.DeltaClose[2] < DeltaTickLine1.DeltaClose[1] && // Tick Delta UP
NetVolDelta1.Buys[1] > MinUpDelta) // Vol Delta UP
{
Values[1][1] = (Low[1] - (OffsetTicks * TickSize));
Print(string.Format("Up Arrow"));
}
}
}
}

Comment