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

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
    cassb
    NinjaTrader Ecosystem Vendor - Logical Forex

    #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.
      cassb
      NinjaTrader Ecosystem Vendor - Logical Forex

      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! :-)
        cassb
        NinjaTrader Ecosystem Vendor - Logical Forex

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        10 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        15 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        14 views
        0 likes
        Last Post strategist007  
        Working...
        X