/// <summary>
 /// update the last value in the collection or add a new one
 /// </summary>
 public void StoreValueTime(int newVal, int timeframeSeconds)
 {
     locker.EnterWriteLock();
     try
     {
         var time = Timeframe.RoundTime(DateTime.Now, timeframeSeconds);
         if (lastTime == null || lastTime.t != time)
         {
             lastTime = new ValueOnTime(time, newVal);
             Values.Add(lastTime);
             return;
         }
         lastTime.v += newVal;
     }
     finally
     {
         locker.ExitWriteLock();
     }
 }
        /// <summary>
        /// append the new value or udate the last one
        /// </summary>
        public void StoreValueTime(UInt32 newVal, int volume, int timeframeSeconds)
        {
            locker.EnterWriteLock();
            try
            {
                var time = Timeframe.RoundTime(DateTime.Now, timeframeSeconds);
                if (lastValue == null || lastValue.t != time)
                {
                    lastValue = new VectorByTime(time, newVal);
                    Vectors.Add(lastValue);
                    return;
                }

                lastValue.AddValue(newVal);
                lastValue.volume = volume;
            }
            finally
            {
                locker.ExitWriteLock();
            }
        }
        /// <summary>
        /// add a new value (OHLC) or update the last one
        /// </summary>
        public void StoreValueTime(float newVal, int timeframeSeconds)
        {
            locker.EnterWriteLock();
            try
            {
                var time = Timeframe.RoundTime(DateTime.Now, timeframeSeconds);
                if (lastCandle == null || lastCandle.t != time)
                {
                    lastCandle = new Candle(time, newVal);
                    Candles.Add(lastCandle);
                    return;
                }

                lastCandle.h  = Math.Max(lastCandle.h, newVal);
                lastCandle.l  = Math.Min(lastCandle.h, newVal);
                lastCandle.c  = newVal;
                lastCandle.s += newVal;
                lastCandle.v++;
            }
            finally
            {
                locker.ExitWriteLock();
            }
        }