Recently, I have been testing longer term strategies in the strategy analyzer using historical EOD data from the yahoo connector.
My strategy instantiates two indicators, in the Initialize() method, ad subscribes to events I have coded in the indicators. I.e:
private indType ind1 = new ind1()
ind1.onNewEvent += ind1eventHandler (OnNewEvent)
add(ind1);
when i run this strategy live, the coding works fine. When I run this strategy in the strategy analyzer I notice the event isn't being thrown, in the parent strategy. Additionally, by adding Print("action") statements to the OnBarUpdate() sections of both the strategy and the indicators, as well as inside the event_thrown methods, and then tracking the sequence of the statements in the output window, it appears to me that ALL the data points (bars) are being processed by the strategy and THEN subsequently, all the bars are being processed by the indicators. It appears this way because ALL the messages from the from the Strategy.onBarUpdate are appearing in the output window followed by ALL the messages by the indicator.onBarUpdate messages.
So my question is, when bars are analyzed historically, what is the the sequence of events, specifically when is the indicator.onbarupdate being thrown, when is the strategy.onbarupdate being thrown? Is there a way to implement an event_thrown structure where the indicator.onbarupdate is thrown prior to the stratgey.onbarupdate, and that sequence for each bar?
ajhg4
Comment