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 kinfxhk, 07-14-2026, 09:39 AM
      0 responses
      127 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      85 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      86 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X