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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X