I subscribe my strategy to Account events (this account is different to the account the strategy is linked).
var MySomeAccount = Account.All.FirstOrDefault(....); MySomeAccount.OrderUpdate += AccountOnOrderUpdate; ... private void AccountOnOrderUpdate(object aSender, OrderEventArgs aArgs) { var aLastClose = this.Close[0]; <--- Here sometimes I have an Exception, because Bars.CurrentBar =0 }
I need some way to synchronize my data flow with my account events. Something like that
private void AccountOnOrderUpdate(object aSender, OrderEventArgs aArgs) { lock (some_bars_sync_object) { var aLastClose = this.Close[0]; } }
Please, point me out, how I can synchronize my account events to my market data updates
Comment