I have a pretty complex indicator that:
- calculates and exposes several dataseries
- uses another indicator that calculates some other dataseries. That is done via assigning the indicator to a variable, and using that variable to access the dataseries.
All this is working fine for a long time.
Now I wanted to use all those in a strategy. So I tried the same way that appears on many posts and in the "indicator methods" section of the help. I assigned the indicator to a variable and tried to use its dataseries.
The strategy's OnBarUpdate needs those values only on bar# 24 and onwards. When it calls the indicator, its OnBarUpdate is called, yet the bar number inside it is 0 and it then gives error "..on bar 0 Object reference not set to an instance".
I tried calling it on every bar from the start.
I tried assigning it to a variable on each OnBarUpdate, or only once in OnStartup.
I tried accessing the dataseries directly using [] and without a variable.
All those did not change the behaviour.
What am I missing here ?
Thanks
Comment