Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Christopher_R, Today, 12:29 AM
    0 responses
    8 views
    0 likes
    Last Post Christopher_R  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    166 responses
    2,235 views
    0 likes
    Last Post sidlercom80  
    Started by thread, Yesterday, 11:58 PM
    0 responses
    3 views
    0 likes
    Last Post thread
    by thread
     
    Started by jclose, Yesterday, 09:37 PM
    0 responses
    7 views
    0 likes
    Last Post jclose
    by jclose
     
    Started by WeyldFalcon, 08-07-2020, 06:13 AM
    10 responses
    1,415 views
    0 likes
    Last Post Traderontheroad  
    Working...
    X