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

Bars Numbering

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

    Bars Numbering

    Hello,
    My question is a very basic one and might have been answered before but could not find any help relating to it.

    How are the bars numbered in NT7 ? Is the CurrentBar always 0 and all previous bars numbered in increments of 1 from right to left ?
    I found some free indicators which are numbering Bars but they are all from right to left , so am confused as to which one to believe.

    #2
    Today is 0, yesterday is 1, etc. Some other platforms use 0, -1, -2, etc. Python code usually does the reverse. In this area there are no standards

    Comment


      #3
      Hello SurenForex,

      Thank you for writing in.

      If you look up a given NinjaScript method in our help guide: http://ninjatrader.com/support/helpG..._reference.htm

      Then anywhere you see "int barsAgo", you know the index of the most recent item is 0 and the values increases the further you go back. This is particularly relevant when working with the Close, Closes, Open, Opens, High, Highs, Low, Lows, Time, Times, Volume, and Volumes methods as well as with DataSeries objects.

      CurrentBar is the number of bars currently on the chart. So for example:
      Code:
      Print(Close[CurrentBar]); //gives you the close of the oldest bar on the chart (the furthest left bar).
      Print(Close[0]); //gives you the close of the most recent bar on the chart (the furthest right bar).
      Anywhere that does not use "int barsAgo", the indexing is standard where 0 is the first item in the array and it increases the further you go forward.

      Please let me know if you require further clarification.
      Last edited by NinjaTrader_MichaelM; 10-11-2015, 09:13 AM.
      Michael M.NinjaTrader Quality Assurance

      Comment


        #4
        Originally posted by SurenForex View Post
        How are the bars numbered in NT7 ? Is the CurrentBar always 0 and all previous bars numbered in increments of 1 from right to left ?
        Yes.
        I found some free indicators which are numbering Bars but they are all from right to left , so am confused as to which one to believe.
        That is the same statement as your question.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Today, 06:40 PM
        0 responses
        4 views
        0 likes
        Last Post algospoke  
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        7 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post quantismo  
        Started by AttiM, 02-14-2024, 05:20 PM
        8 responses
        168 views
        0 likes
        Last Post jeronymite  
        Started by cre8able, Today, 04:22 PM
        0 responses
        9 views
        0 likes
        Last Post cre8able  
        Working...
        X