1) From my research, it appears that for the most part OnMarketData and OnBarUpdate are the same (when CalculateOnClose = false). However, OnMarketData has a MarketDataEventArgs object, whereas OnBarUpdate has nothing. OnMarketData gets a lot more data, ie. all the changes in bid/asks, etc. OnBarUpdate, will not get the latest bid/ask data the way OnMarketData will. It will only get updates to the bar, so the information it receives is a lot more limited, is this correct? Is this the only difference or are there other subtle differences?
2) To build further on the previous question, will there always be a corresponding OnMarketData event for every OnBarUpdate event, but not necessarily an OnBarUpdate event for every OnMarketData event? For example, there won't be a corresponding OnBarUpdate for an OnMarketData where e.MarketDataType == MarketDataType.Ask.
2) Is there a specific order in which OnMarketData and OnBarUpdate get called, ie. does OnMarketData get called before OnBarUpdate, or is there no guarantee? I read in a previous post that there was no guarantee but I just want to verify that is the case.
3) I know for OnMarketData, if e.MarketDataType == MarketDataType.List, then e.Price is the last price. Assuming CalculateOnClose == false, what value can I use in OnBarUpdate that would tell me the value of the last tick that just came in, ie. the price of the last trade? Is it Close[0] or is it something else?
4) I want to separate out my indicator code such that it does all the data processing and gathering in the OnMarketData method, and it does all the graphical updating of the indicator in OnBarUpdate. Is this okay to split up the code this way, or is this not recommended and both should occur in the same method, ie. all the code should be in OnBarUpdate or OnMarketData, but not both. I'm wondering if there are performance implications to do this?
Thanks in advance,
Ken
Comment