/// <summary> /// Color trends off the 3MA bands /// </summary> /// <returns></returns> public ZZColorTrend ZZColorTrend(Data.IDataSeries input, int mALongLen, int mAMedLen, int mAShortLen) { if (cacheZZColorTrend != null) { for (int idx = 0; idx < cacheZZColorTrend.Length; idx++) { if (cacheZZColorTrend[idx].MALongLen == mALongLen && cacheZZColorTrend[idx].MAMedLen == mAMedLen && cacheZZColorTrend[idx].MAShortLen == mAShortLen && cacheZZColorTrend[idx].EqualsInput(input)) { return(cacheZZColorTrend[idx]); } } } lock (checkZZColorTrend) { checkZZColorTrend.MALongLen = mALongLen; mALongLen = checkZZColorTrend.MALongLen; checkZZColorTrend.MAMedLen = mAMedLen; mAMedLen = checkZZColorTrend.MAMedLen; checkZZColorTrend.MAShortLen = mAShortLen; mAShortLen = checkZZColorTrend.MAShortLen; if (cacheZZColorTrend != null) { for (int idx = 0; idx < cacheZZColorTrend.Length; idx++) { if (cacheZZColorTrend[idx].MALongLen == mALongLen && cacheZZColorTrend[idx].MAMedLen == mAMedLen && cacheZZColorTrend[idx].MAShortLen == mAShortLen && cacheZZColorTrend[idx].EqualsInput(input)) { return(cacheZZColorTrend[idx]); } } } ZZColorTrend indicator = new ZZColorTrend(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MALongLen = mALongLen; indicator.MAMedLen = mAMedLen; indicator.MAShortLen = mAShortLen; Indicators.Add(indicator); indicator.SetUp(); ZZColorTrend[] tmp = new ZZColorTrend[cacheZZColorTrend == null ? 1 : cacheZZColorTrend.Length + 1]; if (cacheZZColorTrend != null) { cacheZZColorTrend.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZColorTrend = tmp; return(indicator); } }
/// <summary> /// Color trends off the 3MA bands /// </summary> /// <returns></returns> public ZZColorTrend ZZColorTrend(Data.IDataSeries input, int mALongLen, int mAMedLen, int mAShortLen) { if (cacheZZColorTrend != null) for (int idx = 0; idx < cacheZZColorTrend.Length; idx++) if (cacheZZColorTrend[idx].MALongLen == mALongLen && cacheZZColorTrend[idx].MAMedLen == mAMedLen && cacheZZColorTrend[idx].MAShortLen == mAShortLen && cacheZZColorTrend[idx].EqualsInput(input)) return cacheZZColorTrend[idx]; lock (checkZZColorTrend) { checkZZColorTrend.MALongLen = mALongLen; mALongLen = checkZZColorTrend.MALongLen; checkZZColorTrend.MAMedLen = mAMedLen; mAMedLen = checkZZColorTrend.MAMedLen; checkZZColorTrend.MAShortLen = mAShortLen; mAShortLen = checkZZColorTrend.MAShortLen; if (cacheZZColorTrend != null) for (int idx = 0; idx < cacheZZColorTrend.Length; idx++) if (cacheZZColorTrend[idx].MALongLen == mALongLen && cacheZZColorTrend[idx].MAMedLen == mAMedLen && cacheZZColorTrend[idx].MAShortLen == mAShortLen && cacheZZColorTrend[idx].EqualsInput(input)) return cacheZZColorTrend[idx]; ZZColorTrend indicator = new ZZColorTrend(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MALongLen = mALongLen; indicator.MAMedLen = mAMedLen; indicator.MAShortLen = mAShortLen; Indicators.Add(indicator); indicator.SetUp(); ZZColorTrend[] tmp = new ZZColorTrend[cacheZZColorTrend == null ? 1 : cacheZZColorTrend.Length + 1]; if (cacheZZColorTrend != null) cacheZZColorTrend.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZColorTrend = tmp; return indicator; } }