Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries missing data?

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

    AddDataSeries missing data?

    I am trying to understand processing multiple bars arrays and I am reading the help guide section on that topic. I've built a simple example script to demonstrate an issue I am having. In my case, I am adding an additional 1 minute bars object and each time OnBarUpdate processes this additional bars array, I am adding a 1 count to a plot. I am expecting that the plot will show me 390 updates per day but it is very inconsistent which makes me think I am not understanding something. Here is the code as well as a short video to show my results:

    Code:
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "sjTestXLB";
                    Calculate                                    = Calculate.OnBarClose;
                    IsOverlay                                    = false;
                    DisplayInDataBox                            = true;
                    DrawOnPricePanel                            = true;
                    DrawHorizontalGridLines                        = true;
                    DrawVerticalGridLines                        = true;
                    PaintPriceMarkers                            = true;
                    BarsRequiredToPlot                            = 0;
                    ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                    IsSuspendedWhileInactive                    = true;
                    AddPlot(new Stroke(Brushes.RoyalBlue, 2), PlotStyle.Bar, "TestVal");
                }
                else if (State == State.Configure)
                {
                    AddDataSeries("XLB", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
                }
            }
    
            protected override void OnBarUpdate()
            {
                if (CurrentBars[0] < 0) return;
    
                if(BarsInProgress == 1){
                    TestVal[0] += 1;
                };
            }
    Here is a quick video demonstrating by results:
    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.

    #2
    Hello swcooke,

    Thank you for your note.

    This looks like a data issue, possibly to do with bar caching - I'm seeing it return 390 every day on my end. Let's have you delete your cache and test again.

    To delete the cache, follow the steps below.
    • Shut down NinjaTrader.
    • Open the Documents > NinjaTrader 8 > db folder.
    • Delete the sub-folder named 'cache'.
    • Restart NinjaTrader and test.
    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    72 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    152 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X