/// <summary> /// Signals when EMA bands contracting /// </summary> /// <returns></returns> public ZZTighteningMABands ZZTighteningMABands(Data.IDataSeries input, bool alertOn, int eMAlongLen, int eMAmedLen, int eMAshortLen) { if (cacheZZTighteningMABands != null) { for (int idx = 0; idx < cacheZZTighteningMABands.Length; idx++) { if (cacheZZTighteningMABands[idx].AlertOn == alertOn && cacheZZTighteningMABands[idx].EMAlongLen == eMAlongLen && cacheZZTighteningMABands[idx].EMAmedLen == eMAmedLen && cacheZZTighteningMABands[idx].EMAshortLen == eMAshortLen && cacheZZTighteningMABands[idx].EqualsInput(input)) { return(cacheZZTighteningMABands[idx]); } } } lock (checkZZTighteningMABands) { checkZZTighteningMABands.AlertOn = alertOn; alertOn = checkZZTighteningMABands.AlertOn; checkZZTighteningMABands.EMAlongLen = eMAlongLen; eMAlongLen = checkZZTighteningMABands.EMAlongLen; checkZZTighteningMABands.EMAmedLen = eMAmedLen; eMAmedLen = checkZZTighteningMABands.EMAmedLen; checkZZTighteningMABands.EMAshortLen = eMAshortLen; eMAshortLen = checkZZTighteningMABands.EMAshortLen; if (cacheZZTighteningMABands != null) { for (int idx = 0; idx < cacheZZTighteningMABands.Length; idx++) { if (cacheZZTighteningMABands[idx].AlertOn == alertOn && cacheZZTighteningMABands[idx].EMAlongLen == eMAlongLen && cacheZZTighteningMABands[idx].EMAmedLen == eMAmedLen && cacheZZTighteningMABands[idx].EMAshortLen == eMAshortLen && cacheZZTighteningMABands[idx].EqualsInput(input)) { return(cacheZZTighteningMABands[idx]); } } } ZZTighteningMABands indicator = new ZZTighteningMABands(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.AlertOn = alertOn; indicator.EMAlongLen = eMAlongLen; indicator.EMAmedLen = eMAmedLen; indicator.EMAshortLen = eMAshortLen; Indicators.Add(indicator); indicator.SetUp(); ZZTighteningMABands[] tmp = new ZZTighteningMABands[cacheZZTighteningMABands == null ? 1 : cacheZZTighteningMABands.Length + 1]; if (cacheZZTighteningMABands != null) { cacheZZTighteningMABands.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZTighteningMABands = tmp; return(indicator); } }
/// <summary> /// Signals when EMA bands contracting /// </summary> /// <returns></returns> public ZZTighteningMABands ZZTighteningMABands(Data.IDataSeries input, bool alertOn, int eMAlongLen, int eMAmedLen, int eMAshortLen) { if (cacheZZTighteningMABands != null) for (int idx = 0; idx < cacheZZTighteningMABands.Length; idx++) if (cacheZZTighteningMABands[idx].AlertOn == alertOn && cacheZZTighteningMABands[idx].EMAlongLen == eMAlongLen && cacheZZTighteningMABands[idx].EMAmedLen == eMAmedLen && cacheZZTighteningMABands[idx].EMAshortLen == eMAshortLen && cacheZZTighteningMABands[idx].EqualsInput(input)) return cacheZZTighteningMABands[idx]; lock (checkZZTighteningMABands) { checkZZTighteningMABands.AlertOn = alertOn; alertOn = checkZZTighteningMABands.AlertOn; checkZZTighteningMABands.EMAlongLen = eMAlongLen; eMAlongLen = checkZZTighteningMABands.EMAlongLen; checkZZTighteningMABands.EMAmedLen = eMAmedLen; eMAmedLen = checkZZTighteningMABands.EMAmedLen; checkZZTighteningMABands.EMAshortLen = eMAshortLen; eMAshortLen = checkZZTighteningMABands.EMAshortLen; if (cacheZZTighteningMABands != null) for (int idx = 0; idx < cacheZZTighteningMABands.Length; idx++) if (cacheZZTighteningMABands[idx].AlertOn == alertOn && cacheZZTighteningMABands[idx].EMAlongLen == eMAlongLen && cacheZZTighteningMABands[idx].EMAmedLen == eMAmedLen && cacheZZTighteningMABands[idx].EMAshortLen == eMAshortLen && cacheZZTighteningMABands[idx].EqualsInput(input)) return cacheZZTighteningMABands[idx]; ZZTighteningMABands indicator = new ZZTighteningMABands(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.AlertOn = alertOn; indicator.EMAlongLen = eMAlongLen; indicator.EMAmedLen = eMAmedLen; indicator.EMAshortLen = eMAshortLen; Indicators.Add(indicator); indicator.SetUp(); ZZTighteningMABands[] tmp = new ZZTighteningMABands[cacheZZTighteningMABands == null ? 1 : cacheZZTighteningMABands.Length + 1]; if (cacheZZTighteningMABands != null) cacheZZTighteningMABands.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZTighteningMABands = tmp; return indicator; } }