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 kevinenergy, 02-17-2023, 12:42 PM
    118 responses
    2,778 views
    1 like
    Last Post kevinenergy  
    Started by briansaul, Today, 05:31 AM
    0 responses
    9 views
    0 likes
    Last Post briansaul  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by PaulMohn, Today, 03:49 AM
    0 responses
    8 views
    0 likes
    Last Post PaulMohn  
    Started by inanazsocial, Today, 01:15 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jason  
    Working...
    X