Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader.Data.Bars.GetBars - not returning complete data set

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

    NinjaTrader.Data.Bars.GetBars - not returning complete data set

    Hi All

    I've been battling with this one for a while but it's very intermittent. I'm basically trying to get the 1 tick bars for this session:

    Code:
    				
    Bars myBars;
    Bars.Session.GetNextBeginEnd(DateTime.Now, out sessionBegin, out sessionEnd);
    DebugMessages("Get Bars for" + this.Instrument.FullName);
    myBars = NinjaTrader.Data.Bars.GetBars(Instrument, new Period(PeriodType.Tick, 1,MarketDataType.Last), sessionBegin, DateTime.Now, BarsArray[0].Session, false, false);
    DebugMessages("Bar Retrieve " + Instrument + " Start " + sessionBegin + " End " + DateTime.Now);
    What happens is this.

    First - the request:

    10/9/2013 7:59:59 AM|1|4|Bar Retrieve ZB 12-13 Globex Start 10/8/2013 6:00:00 PM End 10/9/2013 7:59:59 AM

    Then the data returned
    10/9/2013 7:59:59 AM|1|4|Bars From 10/9/2013 7:00:01 AM To 10/9/2013 7:59:57 AM Bars Total 2369

    So I requested bars from 6pm on 8th October (Globex start) but I got data from 7am on 9th October.

    When someone gets this problem, if they go to \My Documents\NinjaTrader 7\db and remove all data, then go restart Ninja, it usually fixes the issue.

    Some days it works, some days it doesn't.

    Is this data being requested from the data vendor in this case? Or is the data coming from Ninjas repository? The issue is intermittent but occurs with Zen, TT & Kinetick.

    Any thoughts?

    Pete

    #2
    Hello,

    Thanks for writing in today.

    I modified your code a small amount so that I could test this without the DebugMessages function.

    First, I need to mention that NinjaTrader.Data.Bars.GetBars() is not supported and there is not documentation on how to use this. This also means that

    While your call uses the correct parameters, and a Bar object is returned, and the there is a Count for this Bar object, I am not able to access elements of this object, as could be done with BarsArray[0] which would be the same type of object.

    Also, the line you have in your post:
    10/9/2013 7:59:59 AM|1|4|Bars From 10/9/2013 7:00:01 AM To 10/9/2013 7:59:57 AM Bars Total 2369

    There is not code for this line in your post. So i'm not exactly sure what is being printed here. If you are printing the session times, this will be coming from Bars.Session.GetNextBeginEnd and not from the NinjaTrader.Data.Bars.GetBars call.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    338 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X