/// <summary> /// Bear 180 /// </summary> /// <returns></returns> public ZZBear180 ZZBear180(Data.IDataSeries input, double elephantSizePct, bool soundAlert, bool useMATrend) { if (cacheZZBear180 != null) { for (int idx = 0; idx < cacheZZBear180.Length; idx++) { if (Math.Abs(cacheZZBear180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBear180[idx].SoundAlert == soundAlert && cacheZZBear180[idx].UseMATrend == useMATrend && cacheZZBear180[idx].EqualsInput(input)) { return(cacheZZBear180[idx]); } } } lock (checkZZBear180) { checkZZBear180.ElephantSizePct = elephantSizePct; elephantSizePct = checkZZBear180.ElephantSizePct; checkZZBear180.SoundAlert = soundAlert; soundAlert = checkZZBear180.SoundAlert; checkZZBear180.UseMATrend = useMATrend; useMATrend = checkZZBear180.UseMATrend; if (cacheZZBear180 != null) { for (int idx = 0; idx < cacheZZBear180.Length; idx++) { if (Math.Abs(cacheZZBear180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBear180[idx].SoundAlert == soundAlert && cacheZZBear180[idx].UseMATrend == useMATrend && cacheZZBear180[idx].EqualsInput(input)) { return(cacheZZBear180[idx]); } } } ZZBear180 indicator = new ZZBear180(); 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(); ZZBear180[] tmp = new ZZBear180[cacheZZBear180 == null ? 1 : cacheZZBear180.Length + 1]; if (cacheZZBear180 != null) { cacheZZBear180.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZBear180 = tmp; return(indicator); } }
/// <summary> /// Bear 180 /// </summary> /// <returns></returns> public ZZBear180 ZZBear180(Data.IDataSeries input, double elephantSizePct, bool soundAlert, bool useMATrend) { if (cacheZZBear180 != null) for (int idx = 0; idx < cacheZZBear180.Length; idx++) if (Math.Abs(cacheZZBear180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBear180[idx].SoundAlert == soundAlert && cacheZZBear180[idx].UseMATrend == useMATrend && cacheZZBear180[idx].EqualsInput(input)) return cacheZZBear180[idx]; lock (checkZZBear180) { checkZZBear180.ElephantSizePct = elephantSizePct; elephantSizePct = checkZZBear180.ElephantSizePct; checkZZBear180.SoundAlert = soundAlert; soundAlert = checkZZBear180.SoundAlert; checkZZBear180.UseMATrend = useMATrend; useMATrend = checkZZBear180.UseMATrend; if (cacheZZBear180 != null) for (int idx = 0; idx < cacheZZBear180.Length; idx++) if (Math.Abs(cacheZZBear180[idx].ElephantSizePct - elephantSizePct) <= double.Epsilon && cacheZZBear180[idx].SoundAlert == soundAlert && cacheZZBear180[idx].UseMATrend == useMATrend && cacheZZBear180[idx].EqualsInput(input)) return cacheZZBear180[idx]; ZZBear180 indicator = new ZZBear180(); 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(); ZZBear180[] tmp = new ZZBear180[cacheZZBear180 == null ? 1 : cacheZZBear180.Length + 1]; if (cacheZZBear180 != null) cacheZZBear180.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZBear180 = tmp; return indicator; } }