Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

countif

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

    countif

    I want to know if the volume is greater than the volume within the past 30 bars.
    This is what I am working with so far..obviously not working...

    if (CountIf(delegate {return Volume[0] > Volume[0];}, 30) > Volume[30])
    {

    }

    #2
    try to use a list that adds the volumevalues every bar. you then can always look back the last 30 entries and compare whatever want to compare, which i didnt even understand. the sum of the last 30 candles, the average or the maximum or what?

    look at this post for a sample of a code that has a very similar mechanic.


    EDIT:
    or that


    basicly the same thing

    EDIT2:
    make sure to use
    using System.Collections.Generic;
    using System.Linq;

    if you wanna use the code displayed in those posts
    Last edited by BigRo; 12-12-2015, 04:25 AM.

    Comment


      #3
      Originally posted by brucelevy View Post
      I want to know if the volume is greater than the volume within the past 30 bars.
      This is what I am working with so far..obviously not working...

      if (CountIf(delegate {return Volume[0] > Volume[0];}, 30) > Volume[30])
      {

      }
      1. The part marked in blue is obviously never true, so ...
      2. What does the request mean? This statement is impossible to understand: "... the volume is greater than the volume within the past 30 bars. "

      Comment


        #4
        Hello brucelevy,

        Thank you for your inquiry.

        Can you please clarify what you mean by "the volume is greater than the volume within the past 30 bars"?

        If you're trying to find the highest volume over the last 30 bars, you can utilize the MAX indicator: https://ninjatrader.com/support/help...aximum_max.htm

        For example:
        Code:
        // prints the highest volume value over the last 30 bars
        double value = MAX(Volume, 30)[0];
        Print("The highest volume over the last 30 bars is " + value.ToString());
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Yes, thank you it seems I may have been very unclear. I was however able to utilize the MAX method by searching for the max volume, then checking if the current volume was higher.

          Thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          630 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          566 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X