/// <summary> /// Displays remaining time of minute based bar /// </summary> /// <returns></returns> public BarTimer BarTimer(Data.IDataSeries input) { if (cacheBarTimer != null) { for (int idx = 0; idx < cacheBarTimer.Length; idx++) { if (cacheBarTimer[idx].EqualsInput(input)) { return(cacheBarTimer[idx]); } } } lock (checkBarTimer) { if (cacheBarTimer != null) { for (int idx = 0; idx < cacheBarTimer.Length; idx++) { if (cacheBarTimer[idx].EqualsInput(input)) { return(cacheBarTimer[idx]); } } } BarTimer indicator = new BarTimer(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; Indicators.Add(indicator); indicator.SetUp(); BarTimer[] tmp = new BarTimer[cacheBarTimer == null ? 1 : cacheBarTimer.Length + 1]; if (cacheBarTimer != null) { cacheBarTimer.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheBarTimer = tmp; return(indicator); } }
/// <summary> /// Displays remaining time of minute based bar /// </summary> /// <returns></returns> public BarTimer BarTimer(Data.IDataSeries input) { if (cacheBarTimer != null) for (int idx = 0; idx < cacheBarTimer.Length; idx++) if (cacheBarTimer[idx].EqualsInput(input)) return cacheBarTimer[idx]; lock (checkBarTimer) { if (cacheBarTimer != null) for (int idx = 0; idx < cacheBarTimer.Length; idx++) if (cacheBarTimer[idx].EqualsInput(input)) return cacheBarTimer[idx]; BarTimer indicator = new BarTimer(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; Indicators.Add(indicator); indicator.SetUp(); BarTimer[] tmp = new BarTimer[cacheBarTimer == null ? 1 : cacheBarTimer.Length + 1]; if (cacheBarTimer != null) cacheBarTimer.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheBarTimer = tmp; return indicator; } }