The problem is that since doing this I have been running into some weird issues, let me preface this with saying that everything calculates on each tick and thus during the market open things move VERY fast especially when managing 500 instruments.
1) OnBarUpdate uses Instrument.FullName to store data in a dictionary based on the current instrument being processed. It almost seems like if I am not done processing another instruments tick that this value will change to the new event that fired. For example:
AAPL -> Incoming Tick -> OnBarUpdate()
- Do some processing reference Instrument.FullName = AAPL
- NVDA -> Incoming Tick -> OnBarUpdate()
- Do Some processing reference Instrument.FullName = NVDA
- AAPL Continues processing, reference Instrument.FullName again = NVDA
I don't know if this is correct but this is what it seems like is happening. I can put some code together to verify this or am I missing something here, should I be using something else? I assume Instrument is a reference to an object that is changing in fast environments whereas the BarsInProgress is a primitive type passed by value and thus things like Closes[BarsInProgress][0] works without flaw etc.
As I mentioned I'm making some assumptions here that could be incorrect but this is what I am currently lead to believe. Can you shed any light onto whether or not I am referencing the current object in the right way?
Comment