I was following the instructions on getting the values from an indicator while using our consolidaor but I'm getting different results from what I believe to be equivalent programming code instructions. I'm using the CMO indicator as an example.
In the attached backtest, I have the following code
# access the 30 minute bar from the DataConsolidated events
thirtyMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=30))
thirtyMinuteConsolidator.DataConsolidated += self.ThirtyMinuteBarHandle
self.cmo = self.CMO(self.symbol, period)
and in the event handler
self.cmo.Update(bar.EndTime, bar.Close)
this provides me with a profit of 0.58%
but when I changed the code to
self.cmo.Update(bar.EndTime, bar.Close)
self.RegisterIndicator(self.symbol, self.cmo, thirtyMinuteConsolidator)
and remove the statemtn for manually updating in the consolidated, then I get him -2% loss.
I have seen both ways in the documentation and also in examples. Are these not equivalent? Thank you for any inputs
I cannot attach the second back test in this message for comparison. I hope that of the code can be changed by just cloning the algorithm making the modifications.