Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar index

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

    Bar index

    Hello

    I'm in the process of porting a technical study from WealthLab 3.0 to Ninjatrader. This study will often reference a previous bar's index. Bar indexing in WL starts from 0 for the earliest bar in the bar array. As a new bar is formed, an incremented index is assigned to this bar. Within this scheme, bars that meet certain conditions can be 'landmrked' by their index which will not change.

    In Ninjatrader, a bar's index does not remain constant. This obviously makes the port of the above study difficult. The most obvious solution would be to perform the entire analysis each time a new bar arrives. Unfortunately this is far from being efficient.

    So the question is, is there a way around this? Is there a way to keep track of a bar's unique index that is constant?

    Along the same lines, the function DrawLine uses 'x bars ago from the current bar' as the input for the x axis coordinate. Do the coordinates of the line change as new bars arrive?

    Thanks in advance.

    #2
    NinjaTrader bar indexing is reverse. 0 refers to latest bar. 1 refers to previous bar. etc. To keep track of a bar number in the left to right fashion you can use CurrentBar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh.

      Comment


        #4
        We have "CurrentBar" which is a pointer that increments from left to right on a chart. Close[int barAgo] is a reference to how many bars ago you wish to access a value for.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks, Ray. I appreciate the prompt reply from you and Josh. I'm all clear now.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sjsj2732, Yesterday, 04:31 AM
          0 responses
          35 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          287 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          286 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          133 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          95 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X