/// <summary>
        /// Measures how far from EMA before snap back
        /// </summary>
        /// <returns></returns>
        public ZZStretchAwayFromEMA ZZStretchAwayFromEMA(Data.IDataSeries input, int eMALen)
        {
            if (cacheZZStretchAwayFromEMA != null)
            {
                for (int idx = 0; idx < cacheZZStretchAwayFromEMA.Length; idx++)
                {
                    if (cacheZZStretchAwayFromEMA[idx].EMALen == eMALen && cacheZZStretchAwayFromEMA[idx].EqualsInput(input))
                    {
                        return(cacheZZStretchAwayFromEMA[idx]);
                    }
                }
            }

            lock (checkZZStretchAwayFromEMA)
            {
                checkZZStretchAwayFromEMA.EMALen = eMALen;
                eMALen = checkZZStretchAwayFromEMA.EMALen;

                if (cacheZZStretchAwayFromEMA != null)
                {
                    for (int idx = 0; idx < cacheZZStretchAwayFromEMA.Length; idx++)
                    {
                        if (cacheZZStretchAwayFromEMA[idx].EMALen == eMALen && cacheZZStretchAwayFromEMA[idx].EqualsInput(input))
                        {
                            return(cacheZZStretchAwayFromEMA[idx]);
                        }
                    }
                }

                ZZStretchAwayFromEMA indicator = new ZZStretchAwayFromEMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.EMALen = eMALen;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZStretchAwayFromEMA[] tmp = new ZZStretchAwayFromEMA[cacheZZStretchAwayFromEMA == null ? 1 : cacheZZStretchAwayFromEMA.Length + 1];
                if (cacheZZStretchAwayFromEMA != null)
                {
                    cacheZZStretchAwayFromEMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]       = indicator;
                cacheZZStretchAwayFromEMA = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Measures how far from EMA before snap back
        /// </summary>
        /// <returns></returns>
        public ZZStretchAwayFromEMA ZZStretchAwayFromEMA(Data.IDataSeries input, int eMALen)
        {
            if (cacheZZStretchAwayFromEMA != null)
                for (int idx = 0; idx < cacheZZStretchAwayFromEMA.Length; idx++)
                    if (cacheZZStretchAwayFromEMA[idx].EMALen == eMALen && cacheZZStretchAwayFromEMA[idx].EqualsInput(input))
                        return cacheZZStretchAwayFromEMA[idx];

            lock (checkZZStretchAwayFromEMA)
            {
                checkZZStretchAwayFromEMA.EMALen = eMALen;
                eMALen = checkZZStretchAwayFromEMA.EMALen;

                if (cacheZZStretchAwayFromEMA != null)
                    for (int idx = 0; idx < cacheZZStretchAwayFromEMA.Length; idx++)
                        if (cacheZZStretchAwayFromEMA[idx].EMALen == eMALen && cacheZZStretchAwayFromEMA[idx].EqualsInput(input))
                            return cacheZZStretchAwayFromEMA[idx];

                ZZStretchAwayFromEMA indicator = new ZZStretchAwayFromEMA();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.EMALen = eMALen;
                Indicators.Add(indicator);
                indicator.SetUp();

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