• 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

How many bars in screen?

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

    How many bars in screen?

    Hi there

    Just a quick question?

    How can I know how many bars are displayed in the chart currently???

    I tried with Bats.Count but it seems to give me the TOTAL number of bars, not how many can be seen in this moment.

    Thank you

    #2
    level2, unfortunately there's no method for this.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      NT7 was not released when this question was asked, so since it is here, is there now a way to count how many bars are currently on screen?

      Comment


        #4
        Hello Unhommefou,

        Yes, NT7 now offers Count:
        http://www.ninjatrader.com/support/h.../nt7/count.htm

        Edit: For bars on screen there is no supported property for this, but can try Koganam's suggestion.
        Last edited by NinjaTrader_RyanM1; 08-11-2011, 08:38 PM.
        Ryan MNinjaTrader Customer Service

        Comment


          #5
          Originally posted by Unhommefou View Post
          NT7 was not released when this question was asked, so since it is here, is there now a way to count how many bars are currently on screen?
          Code:
           
          int intFirstBarOnChart = ChartControl.FirstBarPainted;
          int intLastBarOnChart = ChartControl.LastBarPainted;
          int intBarsOnChart = intLastBarOnChart - intFirstBarOnChart;
          You must be aware, and understand, that ChartControl access will not get any support from NT Support. They will not even answer questions about it.

          Use at your own discretion.
          Last edited by koganam; 08-11-2011, 07:09 PM.

          Comment


            #6
            Originally posted by koganam View Post
            Code:
             
            int intFirstBarOnChart = ChartControl.FirstBarPainted;
            int intLastBarOnChart = ChartControl.LastBarPainted;
            int intBarsOnChart = intLastBarOnChart - intFirstBarOnChart;
            You must be aware, and understand, that ChartControl access will not get any support from NT Support. They will not even answer questions about it.

            Use at your own discretion.
            This worked perfect for me just wanting the indicator printing on shown candles and not all the way back in history. I appreciate the tip.

            Comment


              #7
              In NT8 "FirstBarPainted" and "LastBarPainted" are no members of the ChartTrader object anymore. Is it possible to retrieve the values with NT8?

              Comment


                #8
                Originally posted by BearingHH View Post
                In NT8 "FirstBarPainted" and "LastBarPainted" are no members of the ChartTrader object anymore. Is it possible to retrieve the values with NT8?
                Would suggest for NT8 now you peek into the ChartBars class's FromIndex and ToIndex - https://ninjatrader.com/support/help...?chartbars.htm
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by koganam View Post

                  Code:
                  int intFirstBarOnChart = ChartControl.FirstBarPainted;
                  int intLastBarOnChart = ChartControl.LastBarPainted;
                  int intBarsOnChart = intLastBarOnChart - intFirstBarOnChart;
                  You must be aware, and understand, that ChartControl access will not get any support from NT Support. They will not even answer questions about it. diebestetest
                  Exactly what I needed! You just saved me several hours. Thanks!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by psquare, Today, 03:11 PM
                  4 responses
                  17 views
                  0 likes
                  Last Post psquare
                  by psquare
                   
                  Started by ballboy11, Today, 03:20 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by tonynt, Today, 02:18 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_JoshG  
                  Started by denalek2419, Today, 01:46 PM
                  3 responses
                  12 views
                  0 likes
                  Last Post NinjaTrader_ChristopherJ  
                  Started by REI140205, Today, 12:58 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Jim  
                  Working...
                  X