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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    670 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X