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

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!
          BertrandNinjaTrader Customer Service

          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 TraderBCL, Today, 04:38 AM
                    1 response
                    4 views
                    0 likes
                    Last Post bltdavid  
                    Started by martin70, 03-24-2023, 04:58 AM
                    14 responses
                    105 views
                    0 likes
                    Last Post martin70  
                    Started by Radano, 06-10-2021, 01:40 AM
                    19 responses
                    606 views
                    0 likes
                    Last Post Radano
                    by Radano
                     
                    Started by KenneGaray, Today, 03:48 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post KenneGaray  
                    Started by thanajo, 05-04-2021, 02:11 AM
                    4 responses
                    470 views
                    0 likes
                    Last Post tradingnasdaqprueba  
                    Working...
                    X