Beginning of plot has a vertical line

Hi @cochenuo, One option is to use the Reset() method of the Series object that is probably “Values[0]” (note the plural “Values”, not “Value[0]”) in your indicator on the first data point if your indicator only has one data series.

So for the first data point of your indicator only (if the problem is only with the first data point, and there is not a horizontal line going from the vertical line to the left above where your screenshot ends), the one with the bad Y-Value, you could call this line of code:

Values[0].Reset();

Here is the documentation on this method, which also lines to the help doc for the related method called “IsValidDataPoint()”:

https://ninjatrader.com/support/helpGuides/nt8/reset.htm

When you do this for a data point, the plot won’t be visible.

Here is a contrived example that shows how to not plot an indicator on every 50th price bar. A dot is drawn on the price bar before the bar where the indicator is not plotted so it is easy to identify the bars with the unplotted indicator.

You can do the same kind of “Reset()” logic, but only for the first data point (or first data points) of your indicator until the first bar whose value is a real, valid value.

protected override void OnBarUpdate()
{
	if (CurrentBar % 50 == 0)
		Draw.Dot(this, "IndicatorDotEvery50Bars" + CurrentBar.ToString(System.Globalization.CultureInfo.InvariantCulture), true, 0, Highs[0][0], Brushes.Aqua, false);
	
	Value[0] = Input[0];
	
	if (CurrentBar % 50 == 1)
		Values[0].Reset();
}