Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best practice calling base.OnBarUpdate()

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

    Best practice calling base.OnBarUpdate()

    I can't seem to find a clear answer so I thought I'd ask. For Indicator development (and Drawing Tool development, if it matters) what are the best practices for calling base.OnBarUpdate() (within OnBarUpdate())?

    Sometimes I see "base.OnBarUpdate()" called and sometimes not. Is it required? Always first thing within the function? What circumstances do you want to or not call it? I want to make sure that I'm not causing a performance hit, by it being called twice (once behind the scenes and once by my explicit call).

    It seems that base.OnRender() is necessary for things like the Plots to function properly, which would imply that calling base.OnBarUpdate() would be necessary in some situations too.

    (obviously, I'm referring to calling them within their appropriate OnBarUpdate() or OnRender() locations)

    Thank you and stay safe!
    Last edited by neoikon; 05-12-2020, 09:04 AM.

    #2
    Hello neoikon,

    Thanks for the post.

    Calling base.OnBarUpdate is not necessary, however that may be related to those specific items and how they were developed. Any items you create should not need that. It is also possible they used visual studio and had used a plugin like resharper to generate overrides, that would include base.OnBarUpdate in that use case but its still not needed that is just a normal feature of syntax generation for C# overrides.

    The OnRender override does have base logic so calling base.OnRender can be used logically to either render the plots or not. The pivots uses this in its logic to custom plot.

    For any override method which is a virtual override you don't necessarily need to call the base, that depends if the base has any logic which that would execute. OnRender is the only override that I can think of that has some base logic which actually would affect your end result, there could be others but they are not any of the common overrides.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    77 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X