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

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 nicthe, Today, 09:24 AM
    1 response
    5 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by samish18, Today, 10:13 AM
    0 responses
    3 views
    0 likes
    Last Post samish18  
    Started by kenz987, Yesterday, 10:20 AM
    2 responses
    13 views
    0 likes
    Last Post kenz987
    by kenz987
     
    Started by nicthe, 08-23-2023, 07:53 AM
    7 responses
    197 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by stalt, 12-28-2015, 01:36 PM
    6 responses
    1,536 views
    0 likes
    Last Post giulyko00  
    Working...
    X