/// <summary>
        /// To create a Reactive Extension for the event of candle total volume excess above a specific level.
        /// </summary>
        /// <param name="candleManager">The candles manager.</param>
        /// <param name="series">Candles series, from which a candle will be taken.</param>
        /// <param name="volume">The level. If the <see cref="Unit.Type"/> type equals to <see cref="UnitTypes.Limit"/>, specified price is set. Otherwise, shift value is specified.</param>
        /// <returns>Reactive Extension.</returns>
        public static IObservable <Candle> RxWhenCurrentCandleTotalVolumeMore(this ICandleManager candleManager,
                                                                              CandleSeries series, Unit volume)
        {
            if (series == null)
            {
                throw new ArgumentNullException(nameof(series));
            }
            if (volume == null)
            {
                throw new ArgumentNullException(nameof(volume));
            }
            var finishVolume = volume;

            if (volume.Type != UnitTypes.Limit)
            {
                var curCandle = candleManager.GetCurrentCandle <Candle>(series);

                if (curCandle == null)
                {
                    throw new ArgumentException(nameof(series));
                }

                finishVolume = curCandle.TotalVolume + volume;
            }

            return(candleManager.RxProcessing()
                   .Where(arg => arg.Series == series && arg.Candle.TotalVolume > finishVolume)
                   .Select(arg => arg.Candle));
        }
 /// <summary>
 /// To create a Reactive Extension for candle change event.
 /// </summary>
 /// <param name="candleManager">The candles manager.</param>
 /// <param name="candle">The candle to be traced for change.</param>
 /// <returns>Reactive Extension.</returns>
 public static IObservable <Candle> RxWhenChanged(this ICandleManager candleManager, Candle candle)
 {
     if (candle == null)
     {
         throw new ArgumentNullException(nameof(candle));
     }
     return(candleManager.RxProcessing().Where(arg => arg.Candle == candle).Select(arg => arg.Candle));
 }
        /// <summary>
        /// To create a Reactive Extension for the event of candle closing price excess above a specific level.
        /// </summary>
        /// <param name="candleManager">The candles manager.</param>
        /// <param name="candle">The candle to be traced for the event of candle closing price excess above a specific level.</param>
        /// <param name="price">The level. If the <see cref="Unit.Type"/> type equals to <see cref="UnitTypes.Limit"/>, specified price is set. Otherwise, shift value is specified.</param>
        /// <returns>Reactive Extension.</returns>
        public static IObservable <Candle> RxWhenClosePriceMore(this ICandleManager candleManager, Candle candle,
                                                                Unit price)
        {
            if (candle == null)
            {
                throw new ArgumentNullException(nameof(candle));
            }
            if (price == null)
            {
                throw new ArgumentNullException(nameof(price));
            }

            return(candleManager.RxProcessing().Where(arg => arg.Candle == candle && arg.Candle.ClosePrice > price)
                   .Select(arg => arg.Candle));
        }
        /// <summary>
        /// To create a Reactive Extension for the event of candle total volume excess above a specific level.
        /// </summary>
        /// <param name="candleManager">The candles manager.</param>
        /// <param name="candle">The candle to be traced for the event of candle total volume excess above a specific level.</param>
        /// <param name="volume">The level. If the <see cref="Unit.Type"/> type equals to <see cref="UnitTypes.Limit"/>, specified price is set. Otherwise, shift value is specified.</param>
        /// <returns>Reactive Extension.</returns>
        public static IObservable <Candle> RxWhenTotalVolumeMore(this ICandleManager candleManager, Candle candle,
                                                                 Unit volume)
        {
            if (candle == null)
            {
                throw new ArgumentNullException(nameof(candle));
            }
            if (volume == null)
            {
                throw new ArgumentNullException(nameof(volume));
            }
            var finishVolume = volume.Type == UnitTypes.Limit ? volume : candle.TotalVolume + volume;

            return(candleManager.RxProcessing()
                   .Where(arg => arg.Candle == candle && arg.Candle.TotalVolume > finishVolume)
                   .Select(arg => arg.Candle));
        }