internal BarSlice GetSlice(long barSize) { BarSlice result = null; this.table.TryGetValue(barSize, out result); return(result); }
internal void AddBar(Instrument instrument, Bar bar) { BarSlice barSlice = null; if (!this.table.TryGetValue(bar.Size, out barSlice)) { barSlice = new BarSlice(this.instrumentsCount); this.table.Add(bar.Size, barSlice); } barSlice.AddBar(instrument, bar); }
internal void SetNewBarSlice(long barSize) { if (!this.isActive) { return; } if (Trace.IsLevelEnabled(TraceLevel.Verbose)) { Trace.WriteLine(string.Format("<Strategy.SetNewBarSlice> {0} {1}", this.Name, barSize)); } BarSlice slice = this.barSliceManager.GetSlice(barSize); if (slice != null) { foreach (KeyValuePair <Instrument, Bar> current in slice.Table) { this.OnNewBar(current.Key, current.Value); } this.OnNewBarSlice(barSize); slice.Reset(); } }