Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator's OnBarUpdate() is called twice

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

    Indicator's OnBarUpdate() is called twice

    MyStrategy uses MyIndicator.

    MyStrategy's OnBarUpdate() has a Log() command at the top of the procedure.

    MyIndicaor's OnBarUpdate() has a Log() command at the top of the procedure.

    SCENARIO 1: When MyIndicator is on the chart and MyStrategy is not on the chart:

    According to the Log, on each bar, MyIndicator's OnBarUpdate() is called once. That's expected.

    SCENARIO 2: When MyIndicator is not on the chart, MyStrategy is on the chart and MyStrategy is running:

    According to the Log, on each bar, MyIndicator's OnBarUpdate() is called once, then the MyStrategy's OnBarUpdate() is called once. That's expected

    SCENARIO 3: When MyIndicator is on the chart, MyStrategy is on the chart and MyStrategy is running:

    According to the Log, on each bar, MyIndicator's OnBarUpdate() is called twice, then the MyStrategy's OnBarUpdate() is called once. To me, this is not expected. I expected MyIndicator's OnBarUpdate() to be called once, not twice.

    In scenario 3, why is the MyIndicator's OnBarUpdate() called twice on each bar? Should it be called once?

    I've attached MyStrategy and MyIndicator if you want to try it.
    Attached Files
    Last edited by mgbloomfield; 04-20-2008, 12:02 AM.

    #2
    >> To me, this is not expected. I expected MyIndicator's OnBarUpdate() to be called once
    Incorrect. 2 different instances of MyIndicator are running: one on chart one in strategy.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    65 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    41 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    23 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    26 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    52 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X