Exemplo n.º 1
0
        /// <summary>
        /// The ZZSwingDebug indicator plots lines that represents the swing high and low points.
        /// </summary>
        /// <returns></returns>
        public ZZSwingDebug ZZSwingDebug(Data.IDataSeries input, int strength)
        {
            if (cacheZZSwingDebug != null)
            {
                for (int idx = 0; idx < cacheZZSwingDebug.Length; idx++)
                {
                    if (cacheZZSwingDebug[idx].Strength == strength && cacheZZSwingDebug[idx].EqualsInput(input))
                    {
                        return(cacheZZSwingDebug[idx]);
                    }
                }
            }

            lock (checkZZSwingDebug)
            {
                checkZZSwingDebug.Strength = strength;
                strength = checkZZSwingDebug.Strength;

                if (cacheZZSwingDebug != null)
                {
                    for (int idx = 0; idx < cacheZZSwingDebug.Length; idx++)
                    {
                        if (cacheZZSwingDebug[idx].Strength == strength && cacheZZSwingDebug[idx].EqualsInput(input))
                        {
                            return(cacheZZSwingDebug[idx]);
                        }
                    }
                }

                ZZSwingDebug indicator = new ZZSwingDebug();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator.Strength = strength;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZSwingDebug[] tmp = new ZZSwingDebug[cacheZZSwingDebug == null ? 1 : cacheZZSwingDebug.Length + 1];
                if (cacheZZSwingDebug != null)
                {
                    cacheZZSwingDebug.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZSwingDebug   = tmp;
                return(indicator);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The ZZSwingDebug indicator plots lines that represents the swing high and low points.
        /// </summary>
        /// <returns></returns>
        public ZZSwingDebug ZZSwingDebug(Data.IDataSeries input, int strength)
        {
            if (cacheZZSwingDebug != null)
                for (int idx = 0; idx < cacheZZSwingDebug.Length; idx++)
                    if (cacheZZSwingDebug[idx].Strength == strength && cacheZZSwingDebug[idx].EqualsInput(input))
                        return cacheZZSwingDebug[idx];

            lock (checkZZSwingDebug)
            {
                checkZZSwingDebug.Strength = strength;
                strength = checkZZSwingDebug.Strength;

                if (cacheZZSwingDebug != null)
                    for (int idx = 0; idx < cacheZZSwingDebug.Length; idx++)
                        if (cacheZZSwingDebug[idx].Strength == strength && cacheZZSwingDebug[idx].EqualsInput(input))
                            return cacheZZSwingDebug[idx];

                ZZSwingDebug indicator = new ZZSwingDebug();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Strength = strength;
                Indicators.Add(indicator);
                indicator.SetUp();

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