• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Number of 1 second bars in an hour

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

    Number of 1 second bars in an hour

    Hello, I developed a strategy to export 1 second bar data for external analysis (originally using market replay data, then I reproduced it in backrest) using onbarclose. I found that there were never 3600 bars in an hour. In many cases, there were around 2-3k bars in an hour. Should I be expecting 3600 1 second bars in an hour? If not could you please explain why not?

    Thanks



    #2
    Hello pnealla,

    Welcome to the NinjaTrader forums!

    This would depend on the instrument and whether there are ticks received during that second.

    Are you seeing ticks during these seconds in the historical data window?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea

      Thanks for your reply.

      I am using CL. If no ticks are received in a second during a trading session, it appears that you’re saying that no bar is created? I was thinking that bars were a function of time, not activity.

      Regards,

      pnealla

      Comment


        #4
        Hello pnealla,

        OnBarUpdate() is data driven. If there is no data to drive during that time, there is no bar close for that time.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Chelsea,

          For 1 second data (3600 seconds per hour) is there an alternative to OnBarUpdate() that will work for me or do I need to roll my own at the tick (or some other) level?

          regards,

          pnealla

          Comment


            #6
            Hello pnealla,

            If you want to trigger an event every second even when no data is being received you can use a C# Timer for this.

            Below is a link to an example of a timer.
            https://ninjatrader.com/support/foru...445#post496445
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks again Chelsea.

              Does this mean that if I develop or utilize an indicator that utilizes OnBarUpdate(), say, a moving average, and I then I set it to go back 30 bars (1 second, for example), those 30 bars may not be based upon the past 30 seconds but upon the past 30 bars where data has been received? Wouldn't that randomize the results somewhat?

              Regards,

              pnealla

              Comment


                #8
                Hello pnealla,

                A synchronized series is not going to update unless OnBarUpdate updates.

                If you are writing indicator values to a file on a timer, its going to write the same value for the called indicator over and over.

                Indicators use synchronized series which only update when the bars update.

                An indicator that does averages like SMA isn't going to update unless there is data.

                A custom calculation in the timer that does averages, would be averaging in the value over and over weighing that value.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by pnealla View Post
                  Thanks again Chelsea.

                  Does this mean that if I develop or utilize an indicator that utilizes OnBarUpdate(), say, a moving average, and I then I set it to go back 30 bars (1 second, for example), those 30 bars may not be based upon the past 30 seconds but upon the past 30 bars where data has been received? Wouldn't that randomize the results somewhat?spankbang redtube beeg

                  Regards,

                  pnealla
                  Hello pnealla,

                  Welcome to the NinjaTrader forums!

                  This would depend on the instrument and whether there are ticks received during that second.

                  Are you seeing ticks during these seconds in the historical data window?
                  Last edited by mopakarim9700; 06-24-2019, 01:16 PM.

                  Comment


                    #10
                    Hello mopakarim9700,

                    Welcome to the NinjaTrader forums!
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by gtpiylnu, Today, 11:23 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post gtpiylnu  
                    Started by Trade95, Today, 05:38 PM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_EricB  
                    Started by Karelgp7, Today, 03:16 PM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by orenytz, Today, 01:18 PM
                    1 response
                    22 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by des.kkeng, Today, 01:10 PM
                    1 response
                    13 views
                    0 likes
                    Last Post NinjaTrader_PatrickG  
                    Working...
                    X