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

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.
            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, 02: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 bmartz, 03-12-2024, 06:12 AM
                    4 responses
                    31 views
                    0 likes
                    Last Post bmartz
                    by bmartz
                     
                    Started by Aviram Y, Today, 05:29 AM
                    4 responses
                    12 views
                    0 likes
                    Last Post Aviram Y  
                    Started by algospoke, 04-17-2024, 06:40 PM
                    3 responses
                    28 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by gentlebenthebear, Today, 01:30 AM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by cls71, Today, 04:45 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X