Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ticks per Bar

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

    Ticks per Bar

    Hello,

    I want to calculate the "ticks per rangebar" and the volume with dividing the volume by ticks. I have tried it few times but doesnt work. How can I get the sum of ticks of a range bar please?

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for the post.

    What did you try and what was not working?

    If you were going to do this you would need to count the ticks between the FirstTickOfBar's and then use math for the other part of your calculation.



    I look forward to being of further assistance.

    Comment


      #3
      Hello,

      thank you for your reply. I cant get/find the sum of ticks. I have my structure, my added dataseries, I know the logic, but I´m missing the sum of ticks of a rangebar.

      Yes, I use firsttickofbar for long time to determine the new bar if running a code on cobcfalse. But I dont understand hwo you mean to calculate from this the sum of ticks of Bar[0] or Bar[1].

      Thank you!
      Tony

      Comment


        #4
        Hello

        I am not certain what you mean by sum here. are you trying to make a sum of the various ticks by using math or are you referring to the SUM indicator?

        Comment


          #5
          Hello,

          I mean how I can get the sum of ticks of a minute bar or range bar. When you plot the chart with bars in dataseries 500 ticks then the sum of each bar is 500 ticks. I want to get this sum of ticks of another dataseries (eg minute or rangebar) to know the sum of ticks of each bar.

          I can get of course the volume for minutebars and rangebars, but I dont know how I get the ticks (as described above) for minutebars and rangebars.

          Thank you!
          Tony

          Comment


            #6
            Hello,

            i am having difficulty understanding what part you need help with here. a sum would involve math. is that what you are asking how to do?

            Comment


              #7
              Hello,

              there might be maybe an access to this without math, I dont know. Because one can get the (sum of) volume of a minute bar so maybe there is also some syntax to get the (sum of) ticks of a minute bar. If this is not then I dont know how to get this with math, no idea. What is the input to calculate? "Ticks" from where/how?

              In the helpguide there is
              // Prints the tick count to the output window
              Print("The tick count of the current bar is " + Bars.TickCount.ToString());

              OK but how to get the sum of ticks when the minute bar is closed. From this print sample I dont understand it so that one has like Vol[0] and Vol[1] the "Tick[0]" and "Tick[1]".


              Thank you!
              Tony
              Last edited by tonynt; 12-23-2020, 03:09 PM. Reason: add info

              Comment


                #8
                hello,

                to do a sum would require math or if you are asking about using the SUM indicator you would have to use data in a series.

                Comment


                  #9
                  Hello,

                  what math to do the sum of ticks of a minute bar? What data in a series? Theres nothing in the helpguide for getting the ticks of a minute bar.

                  Comment


                    #10
                    Hello tonynt,

                    If you mean to just add the ticks together while the bar is open that would be a total number of ticks in a bar, you would just add each tick seen to count it.

                    The help guide won't have a specific article on getting the total ticks in a bar but does have information on properties you can use or otherwise explains how the general NinjaScript framework works in relation to tick data.

                    If you are using a tick series you could accumulate a count for each tick seen to a variable.

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

                    Comment


                      #11
                      Hello,

                      thank you for your reply. I found out in the meantime that the trades in volumetric give me the same result. And this I understand how to work with,.
                      But maybe we can bring this thread to and end for not using volumetric dataseries. How can the ticks be accumulated counted and stored for bar[0] and bar[1] please. I think this is just one line for you to post as reply.

                      Thank you!
                      Tony

                      Comment


                        #12
                        Hello tonynt,

                        You can use Calculate.OnEachTick and increment a variable until you see IsFirstTickOfBar, when you can reset that variable back to 0. Before you set it back to 0 in IsFirstTickOfBar, the variable will have the number of ticks in the last bar.

                        If you would like to store the count per bar, you can use a Series object.

                        Series<t> - https://ninjatrader.com/support/help...8/?seriest.htm

                        Note that you would want to assign the count to YourSeries[1] on IsFirstTickOfBar to assign the tick count to the bar that had just closed.

                        We look forward to assisting.
                        Last edited by NinjaTrader_Jim; 12-25-2020, 09:36 AM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        596 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        343 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        103 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        556 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        554 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X