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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      87 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      106 views
      0 likes
      Last Post CarlTrading  
      Working...
      X