Esempio n. 1
0
        /// <summary>
        /// Bull 180
        /// </summary>
        /// <returns></returns>
        public ZZBull180 ZZBull180(Data.IDataSeries input, double elephantSizePct, bool soundAlert, bool useMATrend)
        {
            if (cacheZZBull180 != null)
            {
                for (int idx = 0; idx < cacheZZBull180.Length; idx++)
                {
                    if (Math.Abs(cacheZZBull180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBull180[idx].SoundAlert == soundAlert && cacheZZBull180[idx].UseMATrend == useMATrend && cacheZZBull180[idx].EqualsInput(input))
                    {
                        return(cacheZZBull180[idx]);
                    }
                }
            }

            lock (checkZZBull180)
            {
                checkZZBull180.ElephantSizePct = elephantSizePct;
                elephantSizePct           = checkZZBull180.ElephantSizePct;
                checkZZBull180.SoundAlert = soundAlert;
                soundAlert = checkZZBull180.SoundAlert;
                checkZZBull180.UseMATrend = useMATrend;
                useMATrend = checkZZBull180.UseMATrend;

                if (cacheZZBull180 != null)
                {
                    for (int idx = 0; idx < cacheZZBull180.Length; idx++)
                    {
                        if (Math.Abs(cacheZZBull180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBull180[idx].SoundAlert == soundAlert && cacheZZBull180[idx].UseMATrend == useMATrend && cacheZZBull180[idx].EqualsInput(input))
                        {
                            return(cacheZZBull180[idx]);
                        }
                    }
                }

                ZZBull180 indicator = new ZZBull180();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input           = input;
                indicator.ElephantSizePct = elephantSizePct;
                indicator.SoundAlert      = soundAlert;
                indicator.UseMATrend      = useMATrend;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZBull180[] tmp = new ZZBull180[cacheZZBull180 == null ? 1 : cacheZZBull180.Length + 1];
                if (cacheZZBull180 != null)
                {
                    cacheZZBull180.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZBull180      = tmp;
                return(indicator);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Bull 180
        /// </summary>
        /// <returns></returns>
        public ZZBull180 ZZBull180(Data.IDataSeries input, double elephantSizePct, bool soundAlert, bool useMATrend)
        {
            if (cacheZZBull180 != null)
                for (int idx = 0; idx < cacheZZBull180.Length; idx++)
                    if (Math.Abs(cacheZZBull180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBull180[idx].SoundAlert == soundAlert && cacheZZBull180[idx].UseMATrend == useMATrend && cacheZZBull180[idx].EqualsInput(input))
                        return cacheZZBull180[idx];

            lock (checkZZBull180)
            {
                checkZZBull180.ElephantSizePct = elephantSizePct;
                elephantSizePct = checkZZBull180.ElephantSizePct;
                checkZZBull180.SoundAlert = soundAlert;
                soundAlert = checkZZBull180.SoundAlert;
                checkZZBull180.UseMATrend = useMATrend;
                useMATrend = checkZZBull180.UseMATrend;

                if (cacheZZBull180 != null)
                    for (int idx = 0; idx < cacheZZBull180.Length; idx++)
                        if (Math.Abs(cacheZZBull180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBull180[idx].SoundAlert == soundAlert && cacheZZBull180[idx].UseMATrend == useMATrend && cacheZZBull180[idx].EqualsInput(input))
                            return cacheZZBull180[idx];

                ZZBull180 indicator = new ZZBull180();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.ElephantSizePct = elephantSizePct;
                indicator.SoundAlert = soundAlert;
                indicator.UseMATrend = useMATrend;
                Indicators.Add(indicator);
                indicator.SetUp();

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