/// <summary> /// Using ROC of Kevin_in GA method /// </summary> /// <returns></returns> public ZZBuyTheDipROC ZZBuyTheDipROC(Data.IDataSeries input, int rOCfast, double rOCfastThres, int rOCslow, double rOCslowThres) { if (cacheZZBuyTheDipROC != null) { for (int idx = 0; idx < cacheZZBuyTheDipROC.Length; idx++) { if (cacheZZBuyTheDipROC[idx].ROCfast == rOCfast && Math.Abs(cacheZZBuyTheDipROC[idx].ROCfastThres - rOCfastThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].ROCslow == rOCslow && Math.Abs(cacheZZBuyTheDipROC[idx].ROCslowThres - rOCslowThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].EqualsInput(input)) { return(cacheZZBuyTheDipROC[idx]); } } } lock (checkZZBuyTheDipROC) { checkZZBuyTheDipROC.ROCfast = rOCfast; rOCfast = checkZZBuyTheDipROC.ROCfast; checkZZBuyTheDipROC.ROCfastThres = rOCfastThres; rOCfastThres = checkZZBuyTheDipROC.ROCfastThres; checkZZBuyTheDipROC.ROCslow = rOCslow; rOCslow = checkZZBuyTheDipROC.ROCslow; checkZZBuyTheDipROC.ROCslowThres = rOCslowThres; rOCslowThres = checkZZBuyTheDipROC.ROCslowThres; if (cacheZZBuyTheDipROC != null) { for (int idx = 0; idx < cacheZZBuyTheDipROC.Length; idx++) { if (cacheZZBuyTheDipROC[idx].ROCfast == rOCfast && Math.Abs(cacheZZBuyTheDipROC[idx].ROCfastThres - rOCfastThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].ROCslow == rOCslow && Math.Abs(cacheZZBuyTheDipROC[idx].ROCslowThres - rOCslowThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].EqualsInput(input)) { return(cacheZZBuyTheDipROC[idx]); } } } ZZBuyTheDipROC indicator = new ZZBuyTheDipROC(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.ROCfast = rOCfast; indicator.ROCfastThres = rOCfastThres; indicator.ROCslow = rOCslow; indicator.ROCslowThres = rOCslowThres; Indicators.Add(indicator); indicator.SetUp(); ZZBuyTheDipROC[] tmp = new ZZBuyTheDipROC[cacheZZBuyTheDipROC == null ? 1 : cacheZZBuyTheDipROC.Length + 1]; if (cacheZZBuyTheDipROC != null) { cacheZZBuyTheDipROC.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZBuyTheDipROC = tmp; return(indicator); } }
/// <summary> /// Using ROC of Kevin_in GA method /// </summary> /// <returns></returns> public ZZBuyTheDipROC ZZBuyTheDipROC(Data.IDataSeries input, int rOCfast, double rOCfastThres, int rOCslow, double rOCslowThres) { if (cacheZZBuyTheDipROC != null) for (int idx = 0; idx < cacheZZBuyTheDipROC.Length; idx++) if (cacheZZBuyTheDipROC[idx].ROCfast == rOCfast && Math.Abs(cacheZZBuyTheDipROC[idx].ROCfastThres - rOCfastThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].ROCslow == rOCslow && Math.Abs(cacheZZBuyTheDipROC[idx].ROCslowThres - rOCslowThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].EqualsInput(input)) return cacheZZBuyTheDipROC[idx]; lock (checkZZBuyTheDipROC) { checkZZBuyTheDipROC.ROCfast = rOCfast; rOCfast = checkZZBuyTheDipROC.ROCfast; checkZZBuyTheDipROC.ROCfastThres = rOCfastThres; rOCfastThres = checkZZBuyTheDipROC.ROCfastThres; checkZZBuyTheDipROC.ROCslow = rOCslow; rOCslow = checkZZBuyTheDipROC.ROCslow; checkZZBuyTheDipROC.ROCslowThres = rOCslowThres; rOCslowThres = checkZZBuyTheDipROC.ROCslowThres; if (cacheZZBuyTheDipROC != null) for (int idx = 0; idx < cacheZZBuyTheDipROC.Length; idx++) if (cacheZZBuyTheDipROC[idx].ROCfast == rOCfast && Math.Abs(cacheZZBuyTheDipROC[idx].ROCfastThres - rOCfastThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].ROCslow == rOCslow && Math.Abs(cacheZZBuyTheDipROC[idx].ROCslowThres - rOCslowThres) <= double.Epsilon && cacheZZBuyTheDipROC[idx].EqualsInput(input)) return cacheZZBuyTheDipROC[idx]; ZZBuyTheDipROC indicator = new ZZBuyTheDipROC(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.ROCfast = rOCfast; indicator.ROCfastThres = rOCfastThres; indicator.ROCslow = rOCslow; indicator.ROCslowThres = rOCslowThres; Indicators.Add(indicator); indicator.SetUp(); ZZBuyTheDipROC[] tmp = new ZZBuyTheDipROC[cacheZZBuyTheDipROC == null ? 1 : cacheZZBuyTheDipROC.Length + 1]; if (cacheZZBuyTheDipROC != null) cacheZZBuyTheDipROC.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZBuyTheDipROC = tmp; return indicator; } }