/// <summary> /// MA slope /// </summary> /// <returns></returns> public ZZSlopeMA ZZSlopeMA(Data.IDataSeries input, int mALen) { if (cacheZZSlopeMA != null) { for (int idx = 0; idx < cacheZZSlopeMA.Length; idx++) { if (cacheZZSlopeMA[idx].MALen == mALen && cacheZZSlopeMA[idx].EqualsInput(input)) { return(cacheZZSlopeMA[idx]); } } } lock (checkZZSlopeMA) { checkZZSlopeMA.MALen = mALen; mALen = checkZZSlopeMA.MALen; if (cacheZZSlopeMA != null) { for (int idx = 0; idx < cacheZZSlopeMA.Length; idx++) { if (cacheZZSlopeMA[idx].MALen == mALen && cacheZZSlopeMA[idx].EqualsInput(input)) { return(cacheZZSlopeMA[idx]); } } } ZZSlopeMA indicator = new ZZSlopeMA(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MALen = mALen; Indicators.Add(indicator); indicator.SetUp(); ZZSlopeMA[] tmp = new ZZSlopeMA[cacheZZSlopeMA == null ? 1 : cacheZZSlopeMA.Length + 1]; if (cacheZZSlopeMA != null) { cacheZZSlopeMA.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZSlopeMA = tmp; return(indicator); } }
/// <summary> /// MA slope /// </summary> /// <returns></returns> public ZZSlopeMA ZZSlopeMA(Data.IDataSeries input, int mALen) { if (cacheZZSlopeMA != null) for (int idx = 0; idx < cacheZZSlopeMA.Length; idx++) if (cacheZZSlopeMA[idx].MALen == mALen && cacheZZSlopeMA[idx].EqualsInput(input)) return cacheZZSlopeMA[idx]; lock (checkZZSlopeMA) { checkZZSlopeMA.MALen = mALen; mALen = checkZZSlopeMA.MALen; if (cacheZZSlopeMA != null) for (int idx = 0; idx < cacheZZSlopeMA.Length; idx++) if (cacheZZSlopeMA[idx].MALen == mALen && cacheZZSlopeMA[idx].EqualsInput(input)) return cacheZZSlopeMA[idx]; ZZSlopeMA indicator = new ZZSlopeMA(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MALen = mALen; Indicators.Add(indicator); indicator.SetUp(); ZZSlopeMA[] tmp = new ZZSlopeMA[cacheZZSlopeMA == null ? 1 : cacheZZSlopeMA.Length + 1]; if (cacheZZSlopeMA != null) cacheZZSlopeMA.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZSlopeMA = tmp; return indicator; } }