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 hazylizard, Today, 08:38 AM
    0 responses
    1 view
    0 likes
    Last Post hazylizard  
    Started by Max238, Today, 01:28 AM
    5 responses
    42 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by giulyko00, Yesterday, 12:03 PM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by habeebft, Today, 07:27 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_ChristopherS  
    Started by AveryFlynn, Today, 04:57 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X