Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Number of bars visible in chart window

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

    Number of bars visible in chart window

    HI NT-8 people ..

    I have been looking for the code / variable that holds the number of bars visible in the current chart window ... is this possible ? I have found lots of info on chartbars, but thats all the bars loaded in the chart .. I just need the number of bars visible in the chart window, which could change if I expand or shrink the window etc ..

    Any help greatly appreciated as always


    #2
    Hello 12tkram,

    Thanks for your post.

    This would be possible by subtracting ChartBars.FromIndex from ChartBars.ToIndex in OnRender().

    Code:
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    {
        ClearOutputWindow();
        Print("Bars Visible: " + (ChartBars.ToIndex - ChartBars.FromIndex));
    }
    Please let me know if you have any questions.

    Comment


      #3
      oooo, thats was quick .. brilliant, will give it a go!!!!!!!!!

      Comment


        #4
        yep, that works perfectly .. thanks again, awesome support as per usual!

        Comment


          #5
          weirdly though, when I add the OnRender() function all my EMA plots disappear? is that expected?

          Comment


            #6
            OnRender() is like a plot override. To also see your plots put this line at the beginning of the OnRender() method:
            base.OnRender(chartControl, chartScale);
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Thanks eDanny

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              333 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X