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

Should I use `update()` with plot dataseries?

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

    Should I use `update()` with plot dataseries?

    Hi.
    lets say in custom indicator, we have plot dataseries:

    Code:
            #region Properties
            [Browsable(false)]	
            [XmlIgnore()]		
            public DataSeries Bullish_upper_Line
            {
                get {  [COLOR="Red"]Update(); [/COLOR] return Values[0]; }
            }
     
            ......
    when we call this indi from another strategy/indi, should we need to have that red "update()" or it is not needed at all?
    If that member was not plot, then we have to update?

    my main confusion is that, when we have to use `update`..

    p.s. I have read the article "exposing values that are not plots" already, just wanted to make sure in this.

    p.s.2 it's good, you have included this hint also in that article.

    #2
    Hello,

    Thank you for the question.

    In this situation the help guide comment provides some clarity on this item:

    This method is only relevant in specific use cases and likely only used by advanced programmers
    You will very likely not need to use this except for very specific situations, for setting a plot you won't need this.



    In the case of the help guide example, we can see a public double is used which is not a Plot, this would require using Update to ensure the value is calculated when this public property is called. You can also see this used in indicators that rewrite historical values or expose custom methods like the ZigZag indicator. The ZigZag has methods to retrieve a value similar to the help guide example which requires Update to be called to ensure OnBarUpdate is run.

    For plots, where you return the Values collection, these do not generally need to have Update() syntax. Again only in very specific situations, this would be needed, the ZigZag is a good example of this.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NRITV, Today, 01:15 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    24 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by quantismo, Yesterday, 05:13 PM
    2 responses
    16 views
    0 likes
    Last Post quantismo  
    Started by frankthearm, Today, 09:08 AM
    6 responses
    27 views
    0 likes
    Last Post frankthearm  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X