/// <summary> /// Returns the high value of the past n periods. /// </summary> /// <returns></returns> public jhlMAX jhlMAX(Data.IDataSeries input, int period) { if (cachejhlMAX != null) { for (int idx = 0; idx < cachejhlMAX.Length; idx++) { if (cachejhlMAX[idx].Period == period && cachejhlMAX[idx].EqualsInput(input)) { return(cachejhlMAX[idx]); } } } lock (checkjhlMAX) { checkjhlMAX.Period = period; period = checkjhlMAX.Period; if (cachejhlMAX != null) { for (int idx = 0; idx < cachejhlMAX.Length; idx++) { if (cachejhlMAX[idx].Period == period && cachejhlMAX[idx].EqualsInput(input)) { return(cachejhlMAX[idx]); } } } jhlMAX indicator = new jhlMAX(); 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(); jhlMAX[] tmp = new jhlMAX[cachejhlMAX == null ? 1 : cachejhlMAX.Length + 1]; if (cachejhlMAX != null) { cachejhlMAX.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cachejhlMAX = tmp; return(indicator); } }
/// <summary> /// Returns the high value of the past n periods. /// </summary> /// <returns></returns> public jhlMAX jhlMAX(Data.IDataSeries input, int period) { if (cachejhlMAX != null) for (int idx = 0; idx < cachejhlMAX.Length; idx++) if (cachejhlMAX[idx].Period == period && cachejhlMAX[idx].EqualsInput(input)) return cachejhlMAX[idx]; lock (checkjhlMAX) { checkjhlMAX.Period = period; period = checkjhlMAX.Period; if (cachejhlMAX != null) for (int idx = 0; idx < cachejhlMAX.Length; idx++) if (cachejhlMAX[idx].Period == period && cachejhlMAX[idx].EqualsInput(input)) return cachejhlMAX[idx]; jhlMAX indicator = new jhlMAX(); 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(); jhlMAX[] tmp = new jhlMAX[cachejhlMAX == null ? 1 : cachejhlMAX.Length + 1]; if (cachejhlMAX != null) cachejhlMAX.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cachejhlMAX = tmp; return indicator; } }