/// <summary>
        /// Adaptive Alternate CCI
        /// </summary>
        /// <returns></returns>
        public AdaptiveAlternativeCci AdaptiveAlternativeCci(Data.IDataSeries input, double cycPart, int numBars, int periodMultiplier, int smooth)
        {
            if (cacheAdaptiveAlternativeCci != null)
            {
                for (int idx = 0; idx < cacheAdaptiveAlternativeCci.Length; idx++)
                {
                    if (Math.Abs(cacheAdaptiveAlternativeCci[idx].CycPart - cycPart) <= double.Epsilon && cacheAdaptiveAlternativeCci[idx].NumBars == numBars && cacheAdaptiveAlternativeCci[idx].PeriodMultiplier == periodMultiplier && cacheAdaptiveAlternativeCci[idx].Smooth == smooth && cacheAdaptiveAlternativeCci[idx].EqualsInput(input))
                    {
                        return(cacheAdaptiveAlternativeCci[idx]);
                    }
                }
            }

            lock (checkAdaptiveAlternativeCci)
            {
                checkAdaptiveAlternativeCci.CycPart = cycPart;
                cycPart = checkAdaptiveAlternativeCci.CycPart;
                checkAdaptiveAlternativeCci.NumBars = numBars;
                numBars = checkAdaptiveAlternativeCci.NumBars;
                checkAdaptiveAlternativeCci.PeriodMultiplier = periodMultiplier;
                periodMultiplier = checkAdaptiveAlternativeCci.PeriodMultiplier;
                checkAdaptiveAlternativeCci.Smooth = smooth;
                smooth = checkAdaptiveAlternativeCci.Smooth;

                if (cacheAdaptiveAlternativeCci != null)
                {
                    for (int idx = 0; idx < cacheAdaptiveAlternativeCci.Length; idx++)
                    {
                        if (Math.Abs(cacheAdaptiveAlternativeCci[idx].CycPart - cycPart) <= double.Epsilon && cacheAdaptiveAlternativeCci[idx].NumBars == numBars && cacheAdaptiveAlternativeCci[idx].PeriodMultiplier == periodMultiplier && cacheAdaptiveAlternativeCci[idx].Smooth == smooth && cacheAdaptiveAlternativeCci[idx].EqualsInput(input))
                        {
                            return(cacheAdaptiveAlternativeCci[idx]);
                        }
                    }
                }

                AdaptiveAlternativeCci indicator = new AdaptiveAlternativeCci();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input            = input;
                indicator.CycPart          = cycPart;
                indicator.NumBars          = numBars;
                indicator.PeriodMultiplier = periodMultiplier;
                indicator.Smooth           = smooth;
                Indicators.Add(indicator);
                indicator.SetUp();

                AdaptiveAlternativeCci[] tmp = new AdaptiveAlternativeCci[cacheAdaptiveAlternativeCci == null ? 1 : cacheAdaptiveAlternativeCci.Length + 1];
                if (cacheAdaptiveAlternativeCci != null)
                {
                    cacheAdaptiveAlternativeCci.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]         = indicator;
                cacheAdaptiveAlternativeCci = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Adaptive Alternate CCI
        /// </summary>
        /// <returns></returns>
        public AdaptiveAlternativeCci AdaptiveAlternativeCci(Data.IDataSeries input, double cycPart, int numBars, int periodMultiplier, int smooth)
        {
            if (cacheAdaptiveAlternativeCci != null)
                for (int idx = 0; idx < cacheAdaptiveAlternativeCci.Length; idx++)
                    if (Math.Abs(cacheAdaptiveAlternativeCci[idx].CycPart - cycPart) <= double.Epsilon && cacheAdaptiveAlternativeCci[idx].NumBars == numBars && cacheAdaptiveAlternativeCci[idx].PeriodMultiplier == periodMultiplier && cacheAdaptiveAlternativeCci[idx].Smooth == smooth && cacheAdaptiveAlternativeCci[idx].EqualsInput(input))
                        return cacheAdaptiveAlternativeCci[idx];

            lock (checkAdaptiveAlternativeCci)
            {
                checkAdaptiveAlternativeCci.CycPart = cycPart;
                cycPart = checkAdaptiveAlternativeCci.CycPart;
                checkAdaptiveAlternativeCci.NumBars = numBars;
                numBars = checkAdaptiveAlternativeCci.NumBars;
                checkAdaptiveAlternativeCci.PeriodMultiplier = periodMultiplier;
                periodMultiplier = checkAdaptiveAlternativeCci.PeriodMultiplier;
                checkAdaptiveAlternativeCci.Smooth = smooth;
                smooth = checkAdaptiveAlternativeCci.Smooth;

                if (cacheAdaptiveAlternativeCci != null)
                    for (int idx = 0; idx < cacheAdaptiveAlternativeCci.Length; idx++)
                        if (Math.Abs(cacheAdaptiveAlternativeCci[idx].CycPart - cycPart) <= double.Epsilon && cacheAdaptiveAlternativeCci[idx].NumBars == numBars && cacheAdaptiveAlternativeCci[idx].PeriodMultiplier == periodMultiplier && cacheAdaptiveAlternativeCci[idx].Smooth == smooth && cacheAdaptiveAlternativeCci[idx].EqualsInput(input))
                            return cacheAdaptiveAlternativeCci[idx];

                AdaptiveAlternativeCci indicator = new AdaptiveAlternativeCci();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.CycPart = cycPart;
                indicator.NumBars = numBars;
                indicator.PeriodMultiplier = periodMultiplier;
                indicator.Smooth = smooth;
                Indicators.Add(indicator);
                indicator.SetUp();

                AdaptiveAlternativeCci[] tmp = new AdaptiveAlternativeCci[cacheAdaptiveAlternativeCci == null ? 1 : cacheAdaptiveAlternativeCci.Length + 1];
                if (cacheAdaptiveAlternativeCci != null)
                    cacheAdaptiveAlternativeCci.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheAdaptiveAlternativeCci = tmp;
                return indicator;
            }
        }