However, that is not what currently happens in NinjaTrader 8: Unless an indicator directly implements the OnMarketData() method, it will not be sent the message OnMarketData() whenever there is a level 1 market event, and unless it directly implements OnMarketDepth(), it will not be sent the message OnMarketDepth() whenever there is a level 2 market event.
This is a problem for several reasons:
1) It's different behavior than NT7.
2) It's a violation of the principles of OO, and therefore creates behavior which almost no one will expect. So it also violates the principle of least surprise.
3) To work around the problem, one must either reimplement the inherited method in the subclass (which is bad OO diesign, and against software engineering principles) or else one must implement the method so that all it does is invoke the version of the method it inherits (which many software engineers would think was a bad thing to do, if they saw such code in a code review.)
I strongly suspect that the intent was to optimize the environment so that indicators which don't need to be scheduled to receive level 1 and/or level 2 market event notifications can be left out of the event notification dispatch queue. And that's a commendable design choice. However, the current implementation goes too far, because it apparently assumes that indicators which don't directly implement the OnMarketData() method and/or the OnMarketDepth() method don't need to be notified of level 1 and/or level 2 market data events. But that assumption is false. And there are more sophisticated alternative approaches to achieve the same benefit without any of the downsides of the current design:
1) If an indicator does implement OnMarketData() directly, then add it to the dispatch queue for level 1 market data events. Otherwise, traverse up the class inheritance hierarchy until a class which does directly implement the method is found. If that class is not the original definer (it's an override,) then add the indicator to the dispatch queue. Otherwise, don't.
2) Define a new boolean configuration parameter which controls whether or not an indicator should be added to the level 1 market data event dispatch queue. The default value should be false. The benefit of this approach is that some indicators may want/need to only handle level 1 market data events when the user so requests, and not otherwise.
Whatever approach is chosen, it should be the same for all the various types of market data event notifications (Occam's Razor.)
Comment