Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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 chbruno, Today, 04:10 PM
          0 responses
          3 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          6 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frslvr, 04-11-2024, 07:26 AM
          9 responses
          127 views
          1 like
          Last Post caryc123  
          Working...
          X