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 kaywai, 09-01-2023, 08:44 PM
    5 responses
    601 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    22 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    16 views
    0 likes
    Last Post Pattontje  
    Started by flybuzz, 04-21-2024, 04:07 PM
    17 responses
    230 views
    0 likes
    Last Post TradingLoss  
    Started by agclub, 04-21-2024, 08:57 PM
    3 responses
    17 views
    0 likes
    Last Post TradingLoss  
    Working...
    X