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

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 tsantospinto, 04-12-2024, 07:04 PM
          5 responses
          67 views
          0 likes
          Last Post tsantospinto  
          Started by cre8able, Today, 03:20 PM
          0 responses
          6 views
          0 likes
          Last Post cre8able  
          Started by Fran888, 02-16-2024, 10:48 AM
          3 responses
          48 views
          0 likes
          Last Post Sam2515
          by Sam2515
           
          Started by martin70, 03-24-2023, 04:58 AM
          15 responses
          114 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by The_Sec, Today, 02:29 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X