Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SUM() but not from position [0]

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

    SUM() but not from position [0]

    I would like to Sum a period, but starting at a delayed period

    So not
    Calc= SUM(close,5)
    Which is the sum of the closes from 0 to bars ago 4

    would this mean
    Calc= SUM(close,5)[10]

    that I would sum closes from 9 bars ago to 14?

    is that correct?

    #2
    It's some what confusing be cause [0] is the current bar. The number between the bracket is an offset, so [10] is 10 bars ago. If you consider [0] as bar 1, then [10] is bar 11.

    But, look up variable CurrentBar and you'll see that NT counts bars from left to right. But offsets are right to left.

    So,

    double Calc = SUM(Close,5)[10]

    is sum of closing prices between 15 and 10 barsAgo.

    Comment


      #3
      tinkerz, borland is correct. You might want to check into the index values though because the indexes start at 0, so a barsAgo value of 9 would be 9 bars back from the current bar, which is actually 10 bars ago.
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X