Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Running loop on volumetric bar.

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

    Running loop on volumetric bar.

    I am trying to run a loop across several bid/ask levels in a volumetric bar to plot support/resistance levels. I trued
    using for example low+tickvalue*5 and see it adding the volume only at low and at low+ticksize*5 and skip the values between the 2. How do I include volumes at multiple levels?
    Thanks.

    #2
    Hello Trader17,

    Thanks for your post.

    So I may accurately assist, please let me know exactly how you are defining the loop in your script.

    Are you using GetBidVolumeForPrice() and passing in the Low[0] price and Low[0] + tickvalue * 5?

    Do you loop from Low[0] to Low[0]+tickvalue*5?

    I look forward to assisting 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


      #3
      Yes exactly NinjaTrader_BrandonH And I realized that could be the issue as it might skip the levels between those 2. I do not loop in between.

      Comment


        #4
        NinjaTrader_BrandonHsimilar to volumetric bars with more than a tick at each level.

        Comment


          #5
          Hello Trader17,

          Thanks for your notes.

          You would need to loop through all values that you want to include in your script.

          What exactly do you mean by "similar to volumetric bars with more than a tick at each level."?

          How exactly are you defining your loop in the script?

          Are you using GetBidVolumeForPrice()/GetAskVolumeForPrice() and passing in the Low[0] price and Low[0] + tickvalue * 5?

          See this forum thread which you might find helpful: https://forum.ninjatrader.com/forum/...etric-bar-info
          <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


            #6
            Thanks NinjaTrader_BrandonH for the reply. Yes I am using GetBidVolumeForPrice. I want to combine the Bid Volumes from say Low to Lww+TickSize*4 for example making it 5 levels. So in using p=Low I use p+ = Low+TickSize*4
            My question was will p+ add all 5 levels between Low and Low+TickSize*4 that way?
            Was trying to combine 5 tick levels and advance them a tick level at a time and check each of these to find support levels.

            Thanks NinjaTrader_BrandonH
            Last edited by Trader17; 06-28-2023, 08:32 PM.

            Comment


              #7
              NinjaTrader_BrandonHwhat my question was when you pass in Low+(Low+TickSize*4) does NT8 only sum those 2 numbers or all in between the 2? Am using it to build support levels X bars out.
              Thanks.

              Comment


                #8
                QuantKey_Bruce you might know the answer as you always answer my other posts.

                Comment


                  #9
                  You would have to read the individual levels e.g. Low, Low + 1 * TickSize, Low + 2 * TickSize, etc. and sum them yourself - the indicator is not going to do that internally.
                  Bruce DeVault
                  QuantKey Trading Vendor Services
                  NinjaTrader Ecosystem Vendor - QuantKey

                  Comment


                    #10
                    Hello Trader17,

                    Thanks for your notes.

                    QuantKey_Bruce is correct.

                    You would need to use GetBidVolumeForPrice()/GetAskVolumeForPrice() to get the bid/ask volume value at each level, such as Low[0], Low[0] + 1 * Ticksize, etc, because you would only get the value at the price being passed into those methods.

                    Then you would sum the values together within your script.

                    As QuantKey_Bruce stated, this is not done internally within the OF Volumetric Bars so you would need to calculate that yourself.
                    <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


                      #11
                      Originally posted by NinjaTrader_BrandonH View Post
                      Hello Trader17,

                      Thanks for your notes.

                      QuantKey_Bruce is correct.

                      You would need to use GetBidVolumeForPrice()/GetAskVolumeForPrice() to get the bid/ask volume value at each level, such as Low[0], Low[0] + 1 * Ticksize, etc, because you would only get the value at the price being passed into those methods.

                      Then you would sum the values together within your script.

                      As QuantKey_Bruce stated, this is not done internally within the OF Volumetric Bars so you would need to calculate that yourself.
                      Thanks NinjaTrader_BrandonH So when we run a loop and specify like p=Low and p<=High and we sum up 5 levels at a time will p in that case become (p=Low+4 individual levels) and (p<=High+4 individual levels below it) then?
                      Thanks NinjaTrader_BrandonH and QuantKey_Bruce

                      Comment


                        #12
                        Hello Trader17,

                        Thanks for your note.

                        A loop is a C# feature that can travel from point A to point B. In NinjaScript you can use loops because the underlying language being used is C#.

                        The only sample that I can link to is for volumetric bars which can be found below.

                        Volumetric Bars: https://ninjatrader.com/support/help...tric_bars2.htm

                        We do not have any loop samples that I can provide and our support does not offer C# educational services in our support. If you want to use loops you will need to start by learning the underlying language which is C#. I can only provide NinjaScript-specific educational materials. When manually coding NinjaScript there is an expectation that you know how to program in C# before you begin, without that fundamental knowledge it will be very difficult for you to be able to make items in the platform.

                        If using loops is a concept you are having trouble with you could seek out C# educational courses or tutorials to learn C# programming language. Loops are not NinjaScript specific, loops are part of the C# language.

                        You can alternatively hire third-party developers to make items for you if learning C# is outside of your scope.​

                        This forum thread will be open for other community members to share their insights on how to use C# loops.
                        <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


                          #13
                          Originally posted by NinjaTrader_BrandonH View Post
                          Hello Trader17,

                          Thanks for your note.

                          A loop is a C# feature that can travel from point A to point B. In NinjaScript you can use loops because the underlying language being used is C#.

                          The only sample that I can link to is for volumetric bars which can be found below.

                          Volumetric Bars: https://ninjatrader.com/support/help...tric_bars2.htm

                          We do not have any loop samples that I can provide and our support does not offer C# educational services in our support. If you want to use loops you will need to start by learning the underlying language which is C#. I can only provide NinjaScript-specific educational materials. When manually coding NinjaScript there is an expectation that you know how to program in C# before you begin, without that fundamental knowledge it will be very difficult for you to be able to make items in the platform.

                          If using loops is a concept you are having trouble with you could seek out C# educational courses or tutorials to learn C# programming language. Loops are not NinjaScript specific, loops are part of the C# language.

                          You can alternatively hire third-party developers to make items for you if learning C# is outside of your scope.​

                          This forum thread will be open for other community members to share their insights on how to use C# loops.
                          Thanks NinjaTrader_BrandonH for all your help!! You rock!!

                          Comment


                            #14
                            Originally posted by QuantKey_Bruce View Post
                            You would have to read the individual levels e.g. Low, Low + 1 * TickSize, Low + 2 * TickSize, etc. and sum them yourself - the indicator is not going to do that internally.
                            Thanks QuantKey_Bruce Can you post a sample script here with that method?
                            Thanks.

                            Comment


                              #15
                              No, I don't have a specific code sample but you would just be looping through the offset in ticks e.g. double x = 0; for (int i = 0; i < NumTicksToInclude; i++) x += /* get the bid volume for the price that is the low + i * TickSize) */;
                              Bruce DeVault
                              QuantKey Trading Vendor Services
                              NinjaTrader Ecosystem Vendor - QuantKey

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              649 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              370 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              576 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X