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 charlesugo_1, 05-26-2026, 05:03 PM
              0 responses
              68 views
              0 likes
              Last Post charlesugo_1  
              Started by DannyP96, 05-18-2026, 02:38 PM
              1 response
              151 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 05-11-2026, 05:56 AM
              0 responses
              162 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 05-10-2026, 08:12 PM
              0 responses
              100 views
              0 likes
              Last Post CarlTrading  
              Started by Hwop38, 05-04-2026, 07:02 PM
              0 responses
              288 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Working...
              X