示例#1
0
        /// <summary>
        /// Validate if the time series is valid (i.e. is there any overlapping between ticks?)
        /// </summary>
        /// <param name="errorTick">Tick that is overlapped by another</param>
        /// <returns>Returns if the time series is valid</returns>
        private bool IsTimeSeriesValid(out TTick errorTick)
        {
            var periodInstance = Period.CreateInstance();

            errorTick = default(TTick);

            for (int i = 0; i < Ticks.Count() - 1; i++)
            {
                var candleEndTime = periodInstance.NextTimestamp(Ticks.ElementAt(i).DateTime);
                if (candleEndTime > Ticks.ElementAt(i + 1).DateTime)
                {
                    errorTick = Ticks.ElementAt(i);
                    return(false);
                }
            }
            return(true);
        }