• 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 rickyblah12, Today, 08:17 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post rickyblah12  
                  Started by mrlucky1x, Today, 08:07 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post mrlucky1x  
                  Started by uday12, Today, 07:21 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post uday12
                  by uday12
                   
                  Started by voltlon, Today, 05:18 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post voltlon
                  by voltlon
                   
                  Started by Bobisam, Today, 04:57 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post Bobisam
                  by Bobisam
                   
                  Working...
                  X