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

Get Maximum Volume

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

    Get Maximum Volume

    The script below returns the price at which the most volume occurred in a bar. Can we replace "price" with "volume" instead to get the maximum volume itself? Is that possible?

    (+ barsType.Volumes[CurrentBar].GetMaximumVolume(null, out price) + " at price: " + price)

    Will this return the total Volume? (+ barsType.Volumes[CurrentBar].GetMaximumVolume(null, volume) )

    Thank you.

    #2
    Hello Trader17,

    This would not be a feature this method specifically offers however you may be able to use GetTotalVolumeForPrice in combination with the found price. Have you tried getting the price from the maximum and then get the volume for that price? Outside of this, I would need to put in a feature request for specifically providing a volume output from this method.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      How do I get price first and then the total volume at that price? Maybe a feature request will be great too.
      Thank you.

      Comment


        #4
        Hello Trader17,

        In my prior post, I mentioned one way to use the found price toward accessing the volume. You would use both the GetMaximumVolume and GetTotalVolumeForPrice methods to do that. Is this not what you are asking to do?

        If you use GetMaximumVolume first that will output a price where the maximum volume was found. That price could then be used with GetTotalVolumeForPrice which takes a price as the input and returns the total volume for that price. Are you trying to do something other than taking the found price and getting the volume for that price? In your first post, you mentioned that you wanted to replace the found price with volume which the method GetMaximumVolume specifically does not do, but you can later access the volume at that price with GetTotalVolumeForPrice.

        I look forward to being of further assistance.

        JesseNinjaTrader Customer Service

        Comment


          #5
          I want to do both. So I can get the price using GetMaximumVolume. And then how would I use GetTotalVolume for that Maximum? Is there another script to do that in Order Flow? I thought they were different. Like one gets the total volume at price and the other gets the price at which maximum volume occurred. I am looking for the total volume at the maximum. Makes sense?
          Thank you.

          Comment


            #6
            Hello Trader17,

            I agree they are different methods and do have different general purposes but the context in which you are wanting to use these methods you are referring to the same price which has the same volume based on the context of your question.

            If you have used GetMaximumVolume first and now have the price where that maximum volume is, using that same price and retrieving the volume by its price would also be that same maximum as that is the same price being used.

            If you are unsure of the result of these methods, I would suggest that you use prints and test this from your end yourself. You can use the help guide sample to test this question. You would need to move the GetTotalVolumeForPrice to be called after GetMaximumVolume and change GetTotalVolumeForPrice to use "price" instead of "Close[0]".

            Please let me know if I may be of further assistance.




            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,607 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            16 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X