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 Mindset, 04-21-2026, 06:46 AM
              0 responses
              44 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              58 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              35 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by cmoran13, 04-16-2026, 01:02 PM
              0 responses
              95 views
              0 likes
              Last Post cmoran13  
              Started by PaulMohn, 04-10-2026, 11:11 AM
              0 responses
              59 views
              0 likes
              Last Post PaulMohn  
              Working...
              X