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 rocketman7, Today, 01:00 AM
    0 responses
    1 view
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    2 responses
    74 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    193 views
    0 likes
    Last Post Hasadafa  
    Working...
    X