/// <summary> /// customizable DMX /// </summary> /// <returns></returns> public Jurik_DMX_custom Jurik_DMX_custom(Data.IDataSeries input, double _BotLine, double _TopLine, int dMX_len) { if (cacheJurik_DMX_custom != null) { for (int idx = 0; idx < cacheJurik_DMX_custom.Length; idx++) { if (Math.Abs(cacheJurik_DMX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_DMX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_DMX_custom[idx].DMX_len == dMX_len && cacheJurik_DMX_custom[idx].EqualsInput(input)) { return(cacheJurik_DMX_custom[idx]); } } } lock (checkJurik_DMX_custom) { checkJurik_DMX_custom._BotLine = _BotLine; _BotLine = checkJurik_DMX_custom._BotLine; checkJurik_DMX_custom._TopLine = _TopLine; _TopLine = checkJurik_DMX_custom._TopLine; checkJurik_DMX_custom.DMX_len = dMX_len; dMX_len = checkJurik_DMX_custom.DMX_len; if (cacheJurik_DMX_custom != null) { for (int idx = 0; idx < cacheJurik_DMX_custom.Length; idx++) { if (Math.Abs(cacheJurik_DMX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_DMX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_DMX_custom[idx].DMX_len == dMX_len && cacheJurik_DMX_custom[idx].EqualsInput(input)) { return(cacheJurik_DMX_custom[idx]); } } } Jurik_DMX_custom indicator = new Jurik_DMX_custom(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator._BotLine = _BotLine; indicator._TopLine = _TopLine; indicator.DMX_len = dMX_len; Indicators.Add(indicator); indicator.SetUp(); Jurik_DMX_custom[] tmp = new Jurik_DMX_custom[cacheJurik_DMX_custom == null ? 1 : cacheJurik_DMX_custom.Length + 1]; if (cacheJurik_DMX_custom != null) { cacheJurik_DMX_custom.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheJurik_DMX_custom = tmp; return(indicator); } }
/// <summary> /// customizable DMX /// </summary> /// <returns></returns> public Jurik_DMX_custom Jurik_DMX_custom(Data.IDataSeries input, double _BotLine, double _TopLine, int dMX_len) { if (cacheJurik_DMX_custom != null) for (int idx = 0; idx < cacheJurik_DMX_custom.Length; idx++) if (Math.Abs(cacheJurik_DMX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_DMX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_DMX_custom[idx].DMX_len == dMX_len && cacheJurik_DMX_custom[idx].EqualsInput(input)) return cacheJurik_DMX_custom[idx]; lock (checkJurik_DMX_custom) { checkJurik_DMX_custom._BotLine = _BotLine; _BotLine = checkJurik_DMX_custom._BotLine; checkJurik_DMX_custom._TopLine = _TopLine; _TopLine = checkJurik_DMX_custom._TopLine; checkJurik_DMX_custom.DMX_len = dMX_len; dMX_len = checkJurik_DMX_custom.DMX_len; if (cacheJurik_DMX_custom != null) for (int idx = 0; idx < cacheJurik_DMX_custom.Length; idx++) if (Math.Abs(cacheJurik_DMX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_DMX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_DMX_custom[idx].DMX_len == dMX_len && cacheJurik_DMX_custom[idx].EqualsInput(input)) return cacheJurik_DMX_custom[idx]; Jurik_DMX_custom indicator = new Jurik_DMX_custom(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator._BotLine = _BotLine; indicator._TopLine = _TopLine; indicator.DMX_len = dMX_len; Indicators.Add(indicator); indicator.SetUp(); Jurik_DMX_custom[] tmp = new Jurik_DMX_custom[cacheJurik_DMX_custom == null ? 1 : cacheJurik_DMX_custom.Length + 1]; if (cacheJurik_DMX_custom != null) cacheJurik_DMX_custom.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheJurik_DMX_custom = tmp; return indicator; } }