/// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public EMAofATR EMAofATR(Data.IDataSeries input, double multiplier, int period) { if (cacheEMAofATR != null) { for (int idx = 0; idx < cacheEMAofATR.Length; idx++) { if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input)) { return(cacheEMAofATR[idx]); } } } lock (checkEMAofATR) { checkEMAofATR.Multiplier = multiplier; multiplier = checkEMAofATR.Multiplier; checkEMAofATR.Period = period; period = checkEMAofATR.Period; if (cacheEMAofATR != null) { for (int idx = 0; idx < cacheEMAofATR.Length; idx++) { if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input)) { return(cacheEMAofATR[idx]); } } } EMAofATR indicator = new EMAofATR(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Multiplier = multiplier; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); EMAofATR[] tmp = new EMAofATR[cacheEMAofATR == null ? 1 : cacheEMAofATR.Length + 1]; if (cacheEMAofATR != null) { cacheEMAofATR.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheEMAofATR = tmp; return(indicator); } }
/// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public EMAofATR EMAofATR(Data.IDataSeries input, double multiplier, int period) { if (cacheEMAofATR != null) for (int idx = 0; idx < cacheEMAofATR.Length; idx++) if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input)) return cacheEMAofATR[idx]; lock (checkEMAofATR) { checkEMAofATR.Multiplier = multiplier; multiplier = checkEMAofATR.Multiplier; checkEMAofATR.Period = period; period = checkEMAofATR.Period; if (cacheEMAofATR != null) for (int idx = 0; idx < cacheEMAofATR.Length; idx++) if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input)) return cacheEMAofATR[idx]; EMAofATR indicator = new EMAofATR(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Multiplier = multiplier; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); EMAofATR[] tmp = new EMAofATR[cacheEMAofATR == null ? 1 : cacheEMAofATR.Length + 1]; if (cacheEMAofATR != null) cacheEMAofATR.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheEMAofATR = tmp; return indicator; } }