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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        307 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        244 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        348 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        178 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X