Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sum and Bars Ago

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

    Sum and Bars Ago

    Just want to check if I am accessing. BarsAgo correctly

    I want to get / compare the sum of the last 3 bars and the sum of the 3 bars prior to those.

    Sum(input,(3)[0] == the current 3 bars

    Sum(input,(3)[4] == sum of the 3 bars previous




    #2
    Hello sdauteuil,

    Thank you for your post.

    To get and compare the last 3 bars with the previous 3 bars before that, you could use the SUM methods seen below. Please note to include a CurrentBar check to ensure you have enough bars loaded on the chart. For example, you would need to ensure that there are at least 6 bars for the SUMs to calculate.

    double sumOfLast3Bars = SUM(3)[0]; This will get the SUM of the last 3 bars (Close[0], Close[1], and Close[2]).

    double sumOfPrevious3Bars = SUM(3)[3]; This will get the SUM of the previous 3 bars after the last 3 bars (Close[3], Close[4], and Close[5]).

    Please see this help guide documentation for more information about SUM - https://ninjatrader.com/support/help...mation_sum.htm

    Also, please see this documentation about making sure you have enough bars loaded - https://ninjatrader.com/support/help...nough_bars.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    48 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X