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

Calling Update() but to recalculate for every bar

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

    Calling Update() but to recalculate for every bar

    When Update() is called, the indicator will use OnBarUpdate() to ensure the Values are updated to the current bar. However - what if I want the values for ALL bars to be re-calculated? Is there a way to set the internal 'completed' flag to false for the bars? Without having to totally refresh the indicator or call F5

    #2
    I think you're mixing apples and oranges thinking both fruits are the same.

    If the Values are 'up-to-date' for the current bar, then by definition, they are
    'up-to-date' for all bars before that -- OnBarUpdate is accumulative.

    A full 're-calculation' is not equivalent to the concept behind what Update()
    is doing -- and neither is Update() the tip of the spear of what F5 is doing.

    Comment


      #3
      Thanks for your input - I understand that, but should have been more clear. I have a WPF Button on the chart which I use to adjust the value of one of a Simple MA indicator's inputs (the period of the MA). When I click the button, the MA period changes from 7 to 14. Once I click this button to change the period, I want all of the Values for the indicator to be re-calculated. I can do this by manually refreshing/re-loading entirely with F5 after clicking the button to change the period, or I can force a SendKeys() call to F5 once the button is clicked, but don't want to have to do this. I want a method which re-calculates all Values for the indicator without necessarily re-loading/refreshing/restarting the indicator entirely.

      The reason I want to avoid using F5 is because I have another indicator on the chart which takes a very long time to load. I want the Simple MA indicator to re-calculate its Values discreetly without me having to F5 the chart, which causes this other indicator to have to re-load/refresh as well.

      In other words, once I click this button to change the MA period, I want the indicator to recognize that all of its Values are no longer 'up-to-date' for any bar, so that it automatically re-calculates everything. Think this is possible?
      Last edited by NicholasJoannette; 07-31-2021, 08:35 PM.

      Comment


        #4
        Hello NicholasJoannette,

        If you are wanting to calculate different values, it would be necessary to loop through all the previous bars and set new values.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello NicholasJoannette,

          If you are wanting to calculate different values, it would be necessary to loop through all the previous bars and set new values.
          Thanks for your help! Very appreciated.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by The_Sec, Today, 02:29 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by jeronymite, 04-12-2024, 04:26 PM
          2 responses
          30 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by Mindset, 05-06-2023, 09:03 PM
          10 responses
          265 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by michi08, 10-05-2018, 09:31 AM
          5 responses
          743 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by tsantospinto, 04-12-2024, 07:04 PM
          4 responses
          63 views
          0 likes
          Last Post aligator  
          Working...
          X