Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X