Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Highest Volume bar of the day

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

    Highest Volume bar of the day

    I am trying to find out in my strategy if the current bar has the highest volume of the day. I have copied the CurrentDayOHL to CurrendDayVolHL to create a volume high & low volume for each bar. Its returning null. Any one has any ideas

    #2
    Originally posted by [email protected] View Post
    I am trying to find out in my strategy if the current bar has the highest volume of the day. I have copied the CurrentDayOHL to CurrendDayVolHL to create a volume high & low volume for each bar. Its returning null. Any one has any ideas
    The volume of the current bar is already at Volume[0].

    You could just traverse the Volume data series looking for bars with higher volume than Volume[0].

    Something like,

    Code:
    private int ReturnHighestVolumeBar(int Lookback)
    {
        for (int indx = 0; indx < Lookback; ++indx)
        {
            if (indx < CurrentBar)
               if (Volume[indx] > Volume[0])
                  return indx;
        }
       return 0;
    }
    The Lookback argument represents the number of bars for this current session you care about, which you can probably cannibalize from other code.

    Comment


      #3
      Thank you! This make sense. Do you know of any code that uses the lookback from the start of market. Also the Volume[indx) will go back to markets beginning?

      Comment


        #4
        Hello dlespinasse50,

        Thanks for writing in.

        I am glad you have found additional assistance on our forums!

        The barsAgo index will go back as far as the data that is given to the primary data series.

        There is not a given price object or volume object that will give you the reverse order in which the price object can be referenced (starting from the beginning of the data series and ending with the last iterated bar of the data series.) If you would like to reference this data you must loop through the data in the opposite direction.

        The following loop can be used as an example:
        Code:
        for (int i = 0; i < CurrentBar-1; i++)
        {
        }
        Please let me know if you have any further questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thank-you. Let me try this Implementing the High Volume

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by tonynt, 05-21-2019, 06:27 AM
          10 responses
          530 views
          1 like
          Last Post fiendtrades  
          Started by awwenzovs, Today, 08:03 AM
          2 responses
          14 views
          0 likes
          Last Post NinjaTrader_Eduardo  
          Started by Ashkam, 04-29-2024, 09:28 AM
          4 responses
          44 views
          0 likes
          Last Post Ashkam
          by Ashkam
           
          Started by nightstalker, Yesterday, 02:05 PM
          1 response
          30 views
          0 likes
          Last Post NinjaTrader_Eduardo  
          Started by dcriador, Today, 02:09 PM
          0 responses
          8 views
          0 likes
          Last Post dcriador  
          Working...
          X