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.
Comment