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

Initial number of bars on chart prior to loading

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

    Initial number of bars on chart prior to loading

    Hi,

    Is there any way within Ninja Script to find out how may bars will be loaded initially on a chart prior to the chart being loaded?

    Thanks,
    gbard

    #2
    Hello gbrad,

    As long as TickReplay is not being used you could use the Count property on any series to know how many points it has. https://ninjatrader.com/support/help...ries_count.htm

    Code:
    Print(Count);
    If you are going to use that for any index purposes then you would need to subtract depending on the Calculate setting, with OnBarClose you would be looking at Count - 2 to get the last bar, OnEachTick would be Count - 1.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Can't Count be examined during State.DataLoaded?

      Comment


        #4
        Hi Jesse,

        bltdavid gets to my point. I would like to know how many bars would initially get loaded prior to hitting bar 0 in OnBarUpdate. Is that possible?

        Note, I don't really need the exact number, just something near that number.

        In my case, I'm not using TickReplay, but that's good to know.

        Thanks,
        gbrad

        Comment


          #5
          Hello gbrad,

          What you are asking is what I provided in post 2, please try printing the Count property. You can do that on bar 0 or if you wanted in State.DataLoaded.

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

          Comment


            #6
            Hi Jesse,

            Yes, that's what I needed. I tested it and it works fine.

            Thank you very much.

            gbrad

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              As long as TickReplay is not being used you could use the Count property on any series to know how many points it has. [url]https://ninjatrader.com/support/helpGuides
              Hi Jesse.

              So, uh, what does TickReplay have to do with many 'points' in a Series?

              I mean, that sounds counterintuitive -- if you want to know how many historical
              bars exist in the primary data series on the chart, how does that number change
              when TickReplay is used?

              The link you provided does not mention a relationship between Count and TickReplay.

              Comment


                #8
                Hello bltdavid,

                When TickReplay is enabled the bars are being built from tickreplay data so the count is not known ahead of time when used from OnBarUpdate.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Rocket, Today, 08:05 PM
                0 responses
                1 view
                0 likes
                Last Post Rocket
                by Rocket
                 
                Started by Rocket, Today, 07:43 PM
                0 responses
                1 view
                0 likes
                Last Post Rocket
                by Rocket
                 
                Started by javier.filgueira, Today, 03:07 PM
                0 responses
                32 views
                0 likes
                Last Post javier.filgueira  
                Started by cassb, Today, 03:09 PM
                0 responses
                28 views
                0 likes
                Last Post cassb
                by cassb
                 
                Started by ChasK, Today, 10:03 AM
                3 responses
                44 views
                0 likes
                Last Post Lancer
                by Lancer
                 
                Working...
                X