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

need to apply Update() on properties

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

    need to apply Update() on properties

    I have been using this indicator for many years and found out today that the properties is not automatically showing correct value in multitimeframe strategies when i apply the firsttickofbar.
    i had to fix it by adding a Update() before the property returned values.
    i notice that none of the indicators provided by NT actually uses this function.
    can someone clarify why Update() makes a difference as i am wondering if i should apply this to all my indicators
    Attached Files

    #2
    Hello junkone,

    Thank you for your post.

    Update() is only needed for certain use cases. In the case of a hosted indicator, like when you use this indicator in a strategy, the indicator needs to be accessed in one of three ways to make sure that OnBarUpdate() functions as expected. The three ways are:
    1. Call Update() on the hosted indicator within the host script
    2. Include a plot in the hosted indicator and access the plot in the host script
    3. Include a plot in the hosted indicator and add the indicator to a chart with AddChartIndicator() (this applies to strategies only)
    This information is explained in the "Notes" section of the OnBarUpdate() page here:For more information regarding Update():Here is a reference sample that exposes an indicator value that is not a plot:
    • https://ninjatrader.com/support/help...alues_that.htm
      • See the ExposedVariable in the SampleBoolSeries.cs indicator script - Update() is called in the Properties region to ensure the exposed variable is up-to-date when accessed in a host script, such as the SampleBoolSeriesStrategy.cs strategy.
    Hopefully this helps to clarify the specific use cases where Update() is needed. Please feel free to reach out with any additional questions or concerns.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X