Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 trilliantrader, 04-18-2024, 08:16 AM
      4 responses
      18 views
      0 likes
      Last Post trilliantrader  
      Started by mgco4you, Today, 09:46 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by wzgy0920, Today, 09:53 PM
      0 responses
      9 views
      0 likes
      Last Post wzgy0920  
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      10 views
      0 likes
      Last Post Rapine Heihei  
      Working...
      X