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 Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,293 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X