Hi

I've set up two consolidators, one for days starting/ending at New York 17:00 and one for weeks starting/ending at at New York Friday 17:00, each with their own event handler. Both will be used for several Forex and CFD symbols. My question is what order are the event handlers called? For each symbol I'd like the weekly event handler to execute before the daily, but I don't know to ensure that.

Cheers

Tony

Here's the relevant initialisation code:


// Set up instrument data.
foreach (string inst in _fxPairs)
{
// Security fxPair = AddForex(inst, _resolution, Market.Oanda, false); // To match TradingView data.
Security fxPair = AddForex(inst, _resolution, Market.FXCM, false); // To match Research environment.

JPDPSetup instrumentData = new JPDPSetup(fxPair.Symbol, // QC symbol
_dataLookback, // day rolling window size
_smaLen, // SMA length
_smaSlopeLen, // Length for SMA slope
_atrLen // ATR length
);
_setupByInstrument.Add(inst, instrumentData);
}
foreach (string inst in _cfds)
{
// Instrument Data
Security cfd = AddCfd(inst, _resolution, Market.Oanda, false);

JPDPSetup instrumentData = new JPDPSetup(cfd.Symbol, // QC symbol
_dataLookback, // day rolling window size
_smaLen, // SMA length
_smaSlopeLen, // Length for SMA slope
_atrLen // ATR length
);
_setupByInstrument.Add(inst, instrumentData);
}

foreach (var kvp in _setupByInstrument)
{
// This is required because we're using closures below, for more information see:
// http://stackoverflow.com/questions/14907987/access-to-foreach-variable-in-closure-warning
var setupData = kvp.Value;

// Daily consolidation
var nyCloseConsolidator = new QuoteBarConsolidator(NYDaily);
nyCloseConsolidator.DataConsolidated += (sender, baseData) =>
{
// The consolidated bar.
var bar = (IBaseDataBar)baseData; // the consolidated bar
setupData.DailyBarWindow.Add(bar);
// Update indicators and rolling windows.
setupData.Sma.Update(bar.Time, bar.Close);
setupData.SmaWindow.Add(setupData.Sma);
setupData.Atr.Update(bar);
// Strategy actions.
OnNYClose(sender, baseData);
};
SubscriptionManager.AddConsolidator(setupData.Symbol, nyCloseConsolidator);

// Weekly consolidation
var nyWeekConsolidator = new QuoteBarConsolidator(NYWeekly);
nyWeekConsolidator.DataConsolidated += OnNYWeekClose;
SubscriptionManager.AddConsolidator(setupData.Symbol, nyWeekConsolidator);

// Order management
_entries = new List<OrderGroup>(); // *** Think this through.
}