/// <summary> /// JMA Double Stochastic /// </summary> /// <returns></returns> public Jurik_JMA_DoubleStoch Jurik_JMA_DoubleStoch(Data.IDataSeries input, double jma_len, int stoch_len) { if (cacheJurik_JMA_DoubleStoch != null) { for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++) { if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input)) { return(cacheJurik_JMA_DoubleStoch[idx]); } } } lock (checkJurik_JMA_DoubleStoch) { checkJurik_JMA_DoubleStoch.Jma_len = jma_len; jma_len = checkJurik_JMA_DoubleStoch.Jma_len; checkJurik_JMA_DoubleStoch.Stoch_len = stoch_len; stoch_len = checkJurik_JMA_DoubleStoch.Stoch_len; if (cacheJurik_JMA_DoubleStoch != null) { for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++) { if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input)) { return(cacheJurik_JMA_DoubleStoch[idx]); } } } Jurik_JMA_DoubleStoch indicator = new Jurik_JMA_DoubleStoch(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Jma_len = jma_len; indicator.Stoch_len = stoch_len; Indicators.Add(indicator); indicator.SetUp(); Jurik_JMA_DoubleStoch[] tmp = new Jurik_JMA_DoubleStoch[cacheJurik_JMA_DoubleStoch == null ? 1 : cacheJurik_JMA_DoubleStoch.Length + 1]; if (cacheJurik_JMA_DoubleStoch != null) { cacheJurik_JMA_DoubleStoch.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheJurik_JMA_DoubleStoch = tmp; return(indicator); } }
/// <summary> /// JMA Double Stochastic /// </summary> /// <returns></returns> public Jurik_JMA_DoubleStoch Jurik_JMA_DoubleStoch(Data.IDataSeries input, double jma_len, int stoch_len) { if (cacheJurik_JMA_DoubleStoch != null) for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++) if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input)) return cacheJurik_JMA_DoubleStoch[idx]; lock (checkJurik_JMA_DoubleStoch) { checkJurik_JMA_DoubleStoch.Jma_len = jma_len; jma_len = checkJurik_JMA_DoubleStoch.Jma_len; checkJurik_JMA_DoubleStoch.Stoch_len = stoch_len; stoch_len = checkJurik_JMA_DoubleStoch.Stoch_len; if (cacheJurik_JMA_DoubleStoch != null) for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++) if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input)) return cacheJurik_JMA_DoubleStoch[idx]; Jurik_JMA_DoubleStoch indicator = new Jurik_JMA_DoubleStoch(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Jma_len = jma_len; indicator.Stoch_len = stoch_len; Indicators.Add(indicator); indicator.SetUp(); Jurik_JMA_DoubleStoch[] tmp = new Jurik_JMA_DoubleStoch[cacheJurik_JMA_DoubleStoch == null ? 1 : cacheJurik_JMA_DoubleStoch.Length + 1]; if (cacheJurik_JMA_DoubleStoch != null) cacheJurik_JMA_DoubleStoch.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheJurik_JMA_DoubleStoch = tmp; return indicator; } }