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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    646 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    367 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X