Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get multi-series current bar data

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

    How to get multi-series current bar data

    I want to know what the high and low of the current bar on a multi-series chart is. I thought I could get it with this code, for example if I'm trying to test to see if the previous bar's high is greater than the high (so far) of the currently-drawing bar on the chart, for bar series index 4:

    if (BarsInProgress == 4)
    {
    if (Highs[4][1] > Highs[4][0]) ...

    But this seems to be comparing the two bars before the currently-drawing bar. If I had Calculate on Bar Close = true, would that affect which bar the Highs[4][0] is referencing? Maybe I need to set that to false?

    Or, another idea, maybe create a fifth bar series as a 1-tick series and then:

    if (BarsInProgress == 5)
    {
    if (Highs[4][1] > Highs[4][0]) ...


    I guess my problem is that I want this Highs[4][0] value to be updated on each tick, but only for the Bars index 4. Hmmm... but would Calculate on Bar Close = false do the same thing? Would it make the indicator extremely slow though because I have 5 bars series on it?

    Thanks!
    Bryan

    #2
    Hi Bryan,

    Yes it depends on whether you're using real time with COBC = false or historical. If you access historically or when COBC = true, you are not able to access values where the time stamp of the bar you're accessing is in advance of the time stamp of other series.

    This is detailed further here in the section How Bar Data is Referenced


    If you want to save resources combining COBC = false logic with COBC = true, this reference sample can help:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Never mind -- sorry. I set Calculate on Bar Close = false and it works beautifully.

      Comment


        #4
        Originally posted by NinjaTrader_RyanM View Post
        Hi Bryan,

        Yes it depends on whether you're using real time with COBC = false or historical. If you access historically or when COBC = true, you are not able to access values where the time stamp of the bar you're accessing is in advance of the time stamp of other series.

        This is detailed further here in the section How Bar Data is Referenced


        If you want to save resources combining COBC = false logic with COBC = true, this reference sample can help:
        http://www.ninjatrader.com/support/f...ad.php?t=19387
        Thanks Ryan -- you are too fast! :-)

        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