Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ticks per Second - how do I count them ?

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

    Ticks per Second - how do I count them ?

    I do not know much about programming but I would like to have a go at making a Indicator that adds up either the ticks or volume that occurs in 1 second, and if it is greater that the previous Max Count then plot it to the indicator. I will NOT use this on a 1 tick or 1 volume chart.

    My question is should I make a 1 second loop and if so how do I do that ?


    Dean.

    #2
    Hello,

    Try something like this:

    if(DateTime.Now.Second != the_last_second)
    {
    if(tick_max < tick_count)
    {
    tick_max = tick_count;
    }

    tick_count = 0;
    the_last_second = DateTime.Now.Second;
    }

    tick_count++;

    I did not test this, however tick_count will track the ticks per second and tick_max will keep the largest tick_count going forward. At some point you will want to reset tick_max to zero, but I am not sure when you want to do this. tick_count gets reset each new second. Hope this helps.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thank you Ben for helping out, much appreciated.

      Comment


        #4
        If anyone is interested here are 2 indicators I managed to get working over the weekend.

        TickPerSecond_Counter counts the ticks that happened each second, only useful on bars that update quicker that once per second. eg: a 1 tick chart. It gives a saw tooth pattern that covers a 1 second interval.


        TickPerSecond_MAX_Counter also counts the ticks that happened each second, but only displays the highest value it counted per second that happened over the period of 1 bar. This is the one to use on bars that take longer that 1 second to complete.

        I have only checked them on Replay Mode over the weekend with a quick try on live data just now, but they seem ok.

        You can ignore the standard BuySell volume indicator I have on the chart, or not :-), one thing I noticed is on a high intensity spike where most of the BuySell bars are RED for that 1 second, price rises soon after.

        These indicators will only display on live data and going forwards in time, they do not display on historical data. They also work in Replay but only correctly if at 1x speed as they use the PC clock for timing. I do not yet know what will happen if your PC gets very busy.


        Dean.
        Attached Files

        Comment


          #5
          Thanks for posting your work here Dean!

          Comment


            #6
            great indicator, is there anyway to count the tick number in the last 30 seconds? thanks


            Originally posted by deanz View Post
            If anyone is interested here are 2 indicators I managed to get working over the weekend.

            TickPerSecond_Counter counts the ticks that happened each second, only useful on bars that update quicker that once per second. eg: a 1 tick chart. It gives a saw tooth pattern that covers a 1 second interval.


            TickPerSecond_MAX_Counter also counts the ticks that happened each second, but only displays the highest value it counted per second that happened over the period of 1 bar. This is the one to use on bars that take longer that 1 second to complete.

            I have only checked them on Replay Mode over the weekend with a quick try on live data just now, but they seem ok.

            You can ignore the standard BuySell volume indicator I have on the chart, or not :-), one thing I noticed is on a high intensity spike where most of the BuySell bars are RED for that 1 second, price rises soon after.

            These indicators will only display on live data and going forwards in time, they do not display on historical data. They also work in Replay but only correctly if at 1x speed as they use the PC clock for timing. I do not yet know what will happen if your PC gets very busy.

            Dean.

            Comment


              #7
              Originally posted by biorjin View Post
              great indicator, is there anyway to count the tick number in the last 30 seconds? thanks
              Pull up a 30 second chart and read the value off the regular volume indicator.

              Comment


                #8
                Thanks guys for doing this.

                I'm always looking for new ways to watch the markets.

                RJay
                RJay
                NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                Comment


                  #9
                  Thanks.

                  Originally posted by deanz View Post
                  Pull up a 30 second chart and read the value off the regular volume indicator.
                  How to script a timeframe(1s,20s,etc) tick_number indicator?

                  Thanks

                  Comment


                    #10
                    There is a nice time histogram indicator here:



                    Also if you want ideas on possible ways to use it.



                    .

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    648 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X