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 bortz, 11-06-2023, 08:04 AM
    47 responses
    1,605 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    8 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    13 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X