/// <summary> /// Returns a value of 1 when the current close is greater than the prior close after penetrating the lowest low of the last n bars. /// </summary> /// <returns></returns> public KeyReversalUp KeyReversalUp(Data.IDataSeries input, int period) { if (cacheKeyReversalUp != null) { for (int idx = 0; idx < cacheKeyReversalUp.Length; idx++) { if (cacheKeyReversalUp[idx].Period == period && cacheKeyReversalUp[idx].EqualsInput(input)) { return(cacheKeyReversalUp[idx]); } } } lock (checkKeyReversalUp) { checkKeyReversalUp.Period = period; period = checkKeyReversalUp.Period; if (cacheKeyReversalUp != null) { for (int idx = 0; idx < cacheKeyReversalUp.Length; idx++) { if (cacheKeyReversalUp[idx].Period == period && cacheKeyReversalUp[idx].EqualsInput(input)) { return(cacheKeyReversalUp[idx]); } } } KeyReversalUp indicator = new KeyReversalUp(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); KeyReversalUp[] tmp = new KeyReversalUp[cacheKeyReversalUp == null ? 1 : cacheKeyReversalUp.Length + 1]; if (cacheKeyReversalUp != null) { cacheKeyReversalUp.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheKeyReversalUp = tmp; return(indicator); } }
/// <summary> /// Returns a value of 1 when the current close is greater than the prior close after penetrating the lowest low of the last n bars. /// </summary> /// <returns></returns> public KeyReversalUp KeyReversalUp(Data.IDataSeries input, int period) { if (cacheKeyReversalUp != null) for (int idx = 0; idx < cacheKeyReversalUp.Length; idx++) if (cacheKeyReversalUp[idx].Period == period && cacheKeyReversalUp[idx].EqualsInput(input)) return cacheKeyReversalUp[idx]; lock (checkKeyReversalUp) { checkKeyReversalUp.Period = period; period = checkKeyReversalUp.Period; if (cacheKeyReversalUp != null) for (int idx = 0; idx < cacheKeyReversalUp.Length; idx++) if (cacheKeyReversalUp[idx].Period == period && cacheKeyReversalUp[idx].EqualsInput(input)) return cacheKeyReversalUp[idx]; KeyReversalUp indicator = new KeyReversalUp(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); KeyReversalUp[] tmp = new KeyReversalUp[cacheKeyReversalUp == null ? 1 : cacheKeyReversalUp.Length + 1]; if (cacheKeyReversalUp != null) cacheKeyReversalUp.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheKeyReversalUp = tmp; return indicator; } }