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

Best practice - Calling Update() on publicly exposed properties

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

    Best practice - Calling Update() on publicly exposed properties

    Referencing Update() (https://ninjatrader.com/support/help...t8/?update.htm) and bltdavid (https://ninjatrader.com/support/foru...34#post1089734), calling Update() inside the getter of a publicly visible Series ensures all Indicator values are up to date.

    What is best practice when an Indicator may have two dozen publicly visible Series?

    Should Update() be called inside the getter of all publicly visible Series, given Update() will not do anything where there is no bars data waiting to be processed by the indicator?
    Alternatively, does Update() come with a performance impact? Should Update() only be called on one (strategic) publicly visible Series?

    #2
    Hi Shansen, thanks for your question.

    NinjaTrader will update your guest indicator automatically. Update() is typically used when a strategy is running OnEachTick and the programmer needs to ensure the guest indicator has called its OnBarUpdate method and updates its properties for the same tick.

    If Update() is not included in one of the public properties then NinjaTrader will call OnBarUpdate only when a new data point is received. So If you do need to add Update() to all of the get methods then its fine to do so. Performance is always something to consider when running OnEachTick. If the code written is lagging the system because its running OnEachTick then the code would need to be optimized, but in most cases performance should be fine.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,610 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    16 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X