/// <summary> /// Advances the enumerator to the next element of the collection. /// </summary> /// <returns> /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. /// </returns> /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> public bool MoveNext() { while (_enumerator.MoveNext()) { var current = _enumerator.Current; if (current != null) { try { // execute user data filters if (current.DataType != MarketDataType.Auxiliary && !_dataFilter.Filter(_security, current)) { continue; } } catch (Exception err) { OnDataFilterError(err); continue; } // verify that the bar is within the exchange's market hours if (current.DataType != MarketDataType.Auxiliary && !_exchangeHours.IsOpen(current.Time, current.EndTime, _extendedMarketHours)) { if (_liveMode && !current.IsFillForward) { // TODO: replace for setting security.RealTimePrice not to modify security cache data directly _security.SetMarketPrice(current); } continue; } // make sure we haven't passed the end if (current.Time > _endTime) { return(false); } } Current = current; return(true); } return(false); }
/// <summary> /// Advances the enumerator to the next element of the collection. /// </summary> /// <returns> /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. /// </returns> /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> public bool MoveNext() { while (_enumerator.MoveNext()) { var current = _enumerator.Current; if (current != null) { try { // execute user data filters if (current.DataType != MarketDataType.Auxiliary && !_dataFilter.Filter(_security, current)) { continue; } } catch (Exception err) { OnDataFilterError(err); continue; } // verify that the bar is within the exchange's market hours if (current.DataType != MarketDataType.Auxiliary && !_exchange.IsOpenDuringBar(current.Time, current.EndTime, _security.IsExtendedMarketHours)) { continue; } // make sure we haven't passed the end if (current.Time > _endTime) { return(false); } } Current = current; return(true); } return(false); }