protected Bar ConvertAndFlushBar(SpiderBar originalBar)
        {
            Bar convertedAndAddedBar = null;

            lock (LockObject)
            {
                DataManager.Add(this.Instrument,
                    originalBar.BeginTime,
                    originalBar.Open,
                    originalBar.High,
                    originalBar.Low,
                    originalBar.Close,
                    originalBar.Volume,
                    originalBar.Size);

                DataManager.Flush();

                if (originalBar.Size == CurrentExecutionTimePeriodInSeconds)
                {
                    CurrentExecutionBarSeries.Add(originalBar.BeginTime,
                        originalBar.Open,
                        originalBar.High,
                        originalBar.Low,
                        originalBar.Close,
                        originalBar.Volume,
                        originalBar.Size);
                }

                convertedAndAddedBar = DataManager.GetHistoricalBars(this.Instrument,
                    originalBar.BeginTime.AddSeconds(-20*(originalBar.Size)),
                    originalBar.EndTime,
                    BarType.Time,
                    originalBar.Size).Last;
            }

            return convertedAndAddedBar;
        }
 private bool ValidateBar(SpiderBar bar)
 {
     return (bar.Open > 0 &&
             bar.High > 0 &&
             bar.Low > 0 &&
             bar.Close > 0 &&
             bar.Volume > 0);
 }
        private SpiderBar ConvertBar(Bar originalBar)
        {
            SpiderBar spiderBar = new SpiderBar()
            {
                IsComplete = originalBar.IsComplete,
                Open = originalBar.Open,
                High = originalBar.High,
                Low = originalBar.Low,
                Close = originalBar.Close,
                BeginTime = originalBar.BeginTime,
                EndTime = originalBar.EndTime,
                Size = originalBar.Size,
                Volume = originalBar.Volume
            };

            return spiderBar;
        }