void ConstructSourceDataBarProvider(TimeSpan period) { if (_sourceDataBarProvider == null) { if (_sourceDataDelivery.OperationalState != OperationalStateEnum.Operational) { SystemMonitor.OperationError("Can not build data bar provider, source data delivery not ready."); return; } if (_sourceDataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol).AvailableDataBarPeriods.Contains(period) == false) { SystemMonitor.OperationError("Can not build data bar provider, period not supported."); return; } _period = period; _timeControl.Period = period; _sourceDataBarProvider = new DataBarHistoryProvider(_sourceDataDelivery, _sessionInfo, period, 100000); _sourceDataBarProvider.DataBarHistoryUpdateEvent += new DataBarHistoryUpdateDelegate(_sourceDataBarProvider_DataBarHistoryUpdateEvent); } }
public IDataBarHistoryProvider ObtainDataBarHistoryProvider(ComponentId source, Symbol symbol, TimeSpan period) { if (source.IsEmpty || symbol.IsEmpty) { SystemMonitor.Warning("Source or symbol empty."); return null; } lock (this) { if (_dataBarProviders.ContainsKey(source) && _dataBarProviders[source].ContainsKey(symbol) && _dataBarProviders[source][symbol].ContainsKey(period)) { return _dataBarProviders[source][symbol][period]; } } ISourceDataDelivery delivery = GetDataDelivery(source); if (delivery == null) { SystemMonitor.OperationError("Failed to establish data delivery for quote provider."); return null; } RuntimeDataSessionInformation session = delivery.GetSymbolRuntimeSessionInformation(symbol); if (session == null) { SystemMonitor.OperationError("Failed to establish runtime session information for symbol [" + symbol.Name + "]"); } DataBarHistoryProvider provider = new DataBarHistoryProvider(delivery, session.Info, period, null); // By default assign a volume indicator. provider.Indicators.AddIndicator(new VolumeCustom()); AddElement(source, symbol, period, provider); return provider; }
/// <summary> /// /// </summary> public DataBarFilter(DataBarHistoryProvider provider) { _provider = provider; }
/// <summary> /// /// </summary> public DataBarFilter(DataBarHistoryProvider provider) { _provider = provider; }