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

Best way to calculate look up 'where I am' in a multi timeframe case

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

    Best way to calculate look up 'where I am' in a multi timeframe case

    In a multi timeframe case, what is the best/efficient way to look up 'which bar I am in' from one timeframe to another?

    Let's say I am in BarArray[1] and wants to find which bar I am in, in BarArray[0]'s 'space',
    I know it can be done as

    BarArray[0].GetBar(Time[0])

    My question is, is this the best way, as I am doing a lots of this, among multiple timeframes, back and force...

    #2
    Hello,

    You would want to use CurrentBars[]



    This can also be used to ensure enough bars have been loaded across all series so that you don't get out of bounds errors.

    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply, but you misunderstood my question.
      I am not talking about 'right now', I am talking about
      for any given bar in 5 min time frame, how would I calculate it's place in 2-min timeframe?

      Comment


        #4
        Hello,

        If that is the case then yes, this will be the simplest way to obtain this data. Sorry for the confusion, when I saw you were using Time[0] I assumed you just wanted to get the most current bar.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by nissan200sx55, Today, 06:25 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by elirion, Yesterday, 10:03 PM
        5 responses
        13 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by ftsc2022, 10-25-2022, 12:03 PM
        6 responses
        277 views
        0 likes
        Last Post AvaHost
        by AvaHost
         
        Started by RaddiFX, Yesterday, 09:55 PM
        2 responses
        24 views
        0 likes
        Last Post RaddiFX
        by RaddiFX
         
        Started by f.saeidi, Today, 01:12 AM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X