/// <summary> /// Base Class. Do not instantiate /// </summary> /// <returns></returns> public GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize) { if (cacheGomDeltaIndicator != null) { for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++) { if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input)) { return(cacheGomDeltaIndicator[idx]); } } } lock (checkGomDeltaIndicator) { checkGomDeltaIndicator.BackupMode = backupMode; backupMode = checkGomDeltaIndicator.BackupMode; checkGomDeltaIndicator.CalcMode = calcMode; calcMode = checkGomDeltaIndicator.CalcMode; checkGomDeltaIndicator.FilterMode = filterMode; filterMode = checkGomDeltaIndicator.FilterMode; checkGomDeltaIndicator.FilterSize = filterSize; filterSize = checkGomDeltaIndicator.FilterSize; if (cacheGomDeltaIndicator != null) { for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++) { if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input)) { return(cacheGomDeltaIndicator[idx]); } } } GomDeltaIndicator indicator = new GomDeltaIndicator(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.BackupMode = backupMode; indicator.CalcMode = calcMode; indicator.FilterMode = filterMode; indicator.FilterSize = filterSize; Indicators.Add(indicator); indicator.SetUp(); GomDeltaIndicator[] tmp = new GomDeltaIndicator[cacheGomDeltaIndicator == null ? 1 : cacheGomDeltaIndicator.Length + 1]; if (cacheGomDeltaIndicator != null) { cacheGomDeltaIndicator.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheGomDeltaIndicator = tmp; return(indicator); } }
/// <summary> /// Base Class. Do not instantiate /// </summary> /// <returns></returns> public GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize) { if (cacheGomDeltaIndicator != null) for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++) if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input)) return cacheGomDeltaIndicator[idx]; lock (checkGomDeltaIndicator) { checkGomDeltaIndicator.BackupMode = backupMode; backupMode = checkGomDeltaIndicator.BackupMode; checkGomDeltaIndicator.CalcMode = calcMode; calcMode = checkGomDeltaIndicator.CalcMode; checkGomDeltaIndicator.FilterMode = filterMode; filterMode = checkGomDeltaIndicator.FilterMode; checkGomDeltaIndicator.FilterSize = filterSize; filterSize = checkGomDeltaIndicator.FilterSize; if (cacheGomDeltaIndicator != null) for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++) if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input)) return cacheGomDeltaIndicator[idx]; GomDeltaIndicator indicator = new GomDeltaIndicator(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.BackupMode = backupMode; indicator.CalcMode = calcMode; indicator.FilterMode = filterMode; indicator.FilterSize = filterSize; Indicators.Add(indicator); indicator.SetUp(); GomDeltaIndicator[] tmp = new GomDeltaIndicator[cacheGomDeltaIndicator == null ? 1 : cacheGomDeltaIndicator.Length + 1]; if (cacheGomDeltaIndicator != null) cacheGomDeltaIndicator.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheGomDeltaIndicator = tmp; return indicator; } }