Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with Plots in Indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Issue with Plots in Indicator

    Hi I am developing a indicator in NT8. I have issues with the Plots. The weird part is it starts working after certain number of bars say 15 or 20 but for the first 20 bars the plots dont work. I don't see what is the issue in my code. Here is the code and screen shots of the issue.

    In the attachment you can clearly see plot of arrow missing for the first 10 bars and then it start working.


    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "TestArrow";
    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 = true;
    ShowSeries1 = true;
    AddPlot(Brushes.Orange, "PlotSeries1");
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {
    Series1 = new Series<double>(this);
    }
    }
    }

    protected override void OnBarUpdate()
    {
    //Add your custom indicator logic here.
    if ( CurrentBar < 2) return;
    if ( High[0] > High[1] ) {
    Draw.Text(this,@"t1"+CurrentBar,"H",0,High[0]+8*TickSize,Plots[0].Brush);
    PlotSeries1[0]=High[0]+3*TickSize;
    }
    }
    Attached Files

    #2
    Hello supercool,

    This is likely the BarsRequiredToPlot, it defaults at 20 bars.



    I don't see that you have specifically set this in the code you provided, can you try setting this to 0 in your script and then remove it from the chart and re-add it?




    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    156 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    140 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    130 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X