• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

determine first and last available bars in BarsArray

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

    determine first and last available bars in BarsArray

    Dear NT fans & team,

    I am working on a multi-instrument strategy, which I'd like to back-test over several years of daily bars. Not all instruments will be available throughout the full back-testing period, and I need to be able to figure out which instruments are available at any given point in time.

    The information is available; when I run my strategy in the debugger I see exactly what I am looking for under 'BarsArray[...]' labelled as 'firstTime' and 'lastTime'. Unfortunately, I can't figure out where MSVC got this information from, as fields with these names don't seem to exist. I have attached a screenshot.

    The time of the last bar is available as 'BarsArray[...].BarsSeries.LastBarTime', but there does not seem to be an equivalent for the first bar time.

    Please note that the information I am looking for is not equivalent to 'BarsArray[…].FromDate' and 'BarsArray[…].ToDate'; those only hold the date range of the strategy analyzer but not the subset thereof I am looking for.

    Any pointers on this are highly appreciated!

    Thank you,
    best regards

    Felix
    Attached Files

    #2
    Hello fbertram,

    Thanks for your post.

    You could use BarsArray.GetTime() for the starting index (0) and the index for Bars.Count, to get the time of the starting and ending bar. Keep in mind, this will not tell you if there is a gap in the data that you have on your platform. I may recommend viewing a chart for that particular data series to be certain the data exists on your platform.

    Code:
    Print(BarsArray[0].GetTime(BarsArray[0].Count));
    Print(BarsArray[0].GetTime(0));
    Please let us know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NinjaCustomer, Today, 01:01 AM
    0 responses
    3 views
    0 likes
    Last Post NinjaCustomer  
    Started by mohdqallaf, Today, 12:55 AM
    0 responses
    3 views
    0 likes
    Last Post mohdqallaf  
    Started by dvcpro4, Yesterday, 07:08 PM
    2 responses
    25 views
    0 likes
    Last Post NT-Roland  
    Started by chrismcdermut, Yesterday, 01:46 PM
    3 responses
    19 views
    0 likes
    Last Post MojoJojo  
    Started by Bricolico, Yesterday, 09:28 PM
    0 responses
    5 views
    0 likes
    Last Post Bricolico  
    Working...
    X