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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    150 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X