Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current Bar on Initialise

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

    Current Bar on Initialise

    Hi,

    I have an indicator that does alot of calc's so it is not feasible for it to run on every bar on startup so therefore I use this line which wont run the indi until we are at the last bar.

    if (CurrentBar < Count - BarsToLookBack)return;

    The issue with this is that if I refresh the indicator when the chart is scrolled back, nothing happens as we are not at the last bar yet.....

    how can I manage the indicator not running on every bar on startup but at the same time being active when I scroll back on the chart? Or loading up when the chart is scrolled back...

    thanks in advance for any help.

    #2
    Hi Marty, I would perhaps look into adding a data series in so the study would be MultiSeries - this way you can force processing up to the last bar all the time even if reloading scrolled back.

    Comment


      #3
      Hi Bertrand and thanks for the fast reply.

      I didnt clarify well enough that I actually also want the indi to load up as if the furthest right bar is the current bar as I scroll back....

      In essense, lets imagine i have a clean chart and i am roughly in the middle of it (scrolled back). When I load the indicator, I want it to be relevant as if the furthest view bar to the right is the current bar.

      I noticed that NT already handles the furthest view bar to the right as the current bar.... but without taking away the above peice of code which cuts out my startup lag.... i cant see how i can make this work...

      Comment


        #4
        Correct, things would be processed as you desire however you lock yourself basically out with the wait to process until the last bar on chart.

        What you could look into would be processing only for what's currently visible on the chart, which would be given by the (undocumented/unsupported) ChartControl's FirstBarIndexPainted / LastBarIndexPainted.

        Comment


          #5
          Interesting, I will look into it. Just wanted to make sure I'm not missing something simple.

          Thanks, I will post back if I find a solution.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 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
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X