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

  • NicholasJoannette
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • NicholasJoannette
    replied
    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.

    Leave a comment:


  • bltdavid
    replied
    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.

    Leave a comment:


  • 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

Latest Posts

Collapse

Topics Statistics Last Post
Started by chumpsky33, Today, 03:21 AM
0 responses
3 views
0 likes
Last Post chumpsky33  
Started by klaus w, Today, 02:09 AM
0 responses
8 views
0 likes
Last Post klaus w
by klaus w
 
Started by RaddiFX, Yesterday, 11:57 PM
1 response
17 views
0 likes
Last Post NinjaTrader_Marco  
Started by Tonofit, Today, 12:00 AM
0 responses
12 views
0 likes
Last Post Tonofit
by Tonofit
 
Started by ck6libra, Yesterday, 11:20 PM
1 response
17 views
0 likes
Last Post NinjaTrader_Manfred  
Working...
X