/// <summary> /// JMA and DWMA plots /// </summary> /// <returns></returns> public Jurik_JMA_DWMA_crossover Jurik_JMA_DWMA_crossover(Data.IDataSeries input, int dwma_len, double jma_len, double jma_phase) { if (cacheJurik_JMA_DWMA_crossover != null) { for (int idx = 0; idx < cacheJurik_JMA_DWMA_crossover.Length; idx++) { if (cacheJurik_JMA_DWMA_crossover[idx].Dwma_len == dwma_len && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_len - jma_len) <= double.Epsilon && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_phase - jma_phase) <= double.Epsilon && cacheJurik_JMA_DWMA_crossover[idx].EqualsInput(input)) { return(cacheJurik_JMA_DWMA_crossover[idx]); } } } lock (checkJurik_JMA_DWMA_crossover) { checkJurik_JMA_DWMA_crossover.Dwma_len = dwma_len; dwma_len = checkJurik_JMA_DWMA_crossover.Dwma_len; checkJurik_JMA_DWMA_crossover.Jma_len = jma_len; jma_len = checkJurik_JMA_DWMA_crossover.Jma_len; checkJurik_JMA_DWMA_crossover.Jma_phase = jma_phase; jma_phase = checkJurik_JMA_DWMA_crossover.Jma_phase; if (cacheJurik_JMA_DWMA_crossover != null) { for (int idx = 0; idx < cacheJurik_JMA_DWMA_crossover.Length; idx++) { if (cacheJurik_JMA_DWMA_crossover[idx].Dwma_len == dwma_len && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_len - jma_len) <= double.Epsilon && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_phase - jma_phase) <= double.Epsilon && cacheJurik_JMA_DWMA_crossover[idx].EqualsInput(input)) { return(cacheJurik_JMA_DWMA_crossover[idx]); } } } Jurik_JMA_DWMA_crossover indicator = new Jurik_JMA_DWMA_crossover(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Dwma_len = dwma_len; indicator.Jma_len = jma_len; indicator.Jma_phase = jma_phase; Indicators.Add(indicator); indicator.SetUp(); Jurik_JMA_DWMA_crossover[] tmp = new Jurik_JMA_DWMA_crossover[cacheJurik_JMA_DWMA_crossover == null ? 1 : cacheJurik_JMA_DWMA_crossover.Length + 1]; if (cacheJurik_JMA_DWMA_crossover != null) { cacheJurik_JMA_DWMA_crossover.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheJurik_JMA_DWMA_crossover = tmp; return(indicator); } }
/// <summary> /// JMA and DWMA plots /// </summary> /// <returns></returns> public Jurik_JMA_DWMA_crossover Jurik_JMA_DWMA_crossover(Data.IDataSeries input, int dwma_len, double jma_len, double jma_phase) { if (cacheJurik_JMA_DWMA_crossover != null) for (int idx = 0; idx < cacheJurik_JMA_DWMA_crossover.Length; idx++) if (cacheJurik_JMA_DWMA_crossover[idx].Dwma_len == dwma_len && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_len - jma_len) <= double.Epsilon && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_phase - jma_phase) <= double.Epsilon && cacheJurik_JMA_DWMA_crossover[idx].EqualsInput(input)) return cacheJurik_JMA_DWMA_crossover[idx]; lock (checkJurik_JMA_DWMA_crossover) { checkJurik_JMA_DWMA_crossover.Dwma_len = dwma_len; dwma_len = checkJurik_JMA_DWMA_crossover.Dwma_len; checkJurik_JMA_DWMA_crossover.Jma_len = jma_len; jma_len = checkJurik_JMA_DWMA_crossover.Jma_len; checkJurik_JMA_DWMA_crossover.Jma_phase = jma_phase; jma_phase = checkJurik_JMA_DWMA_crossover.Jma_phase; if (cacheJurik_JMA_DWMA_crossover != null) for (int idx = 0; idx < cacheJurik_JMA_DWMA_crossover.Length; idx++) if (cacheJurik_JMA_DWMA_crossover[idx].Dwma_len == dwma_len && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_len - jma_len) <= double.Epsilon && Math.Abs(cacheJurik_JMA_DWMA_crossover[idx].Jma_phase - jma_phase) <= double.Epsilon && cacheJurik_JMA_DWMA_crossover[idx].EqualsInput(input)) return cacheJurik_JMA_DWMA_crossover[idx]; Jurik_JMA_DWMA_crossover indicator = new Jurik_JMA_DWMA_crossover(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Dwma_len = dwma_len; indicator.Jma_len = jma_len; indicator.Jma_phase = jma_phase; Indicators.Add(indicator); indicator.SetUp(); Jurik_JMA_DWMA_crossover[] tmp = new Jurik_JMA_DWMA_crossover[cacheJurik_JMA_DWMA_crossover == null ? 1 : cacheJurik_JMA_DWMA_crossover.Length + 1]; if (cacheJurik_JMA_DWMA_crossover != null) cacheJurik_JMA_DWMA_crossover.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheJurik_JMA_DWMA_crossover = tmp; return indicator; } }