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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      319 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      246 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X