/// <summary> /// The MFI (Money Flow Index) is a momentum indicator that measures the strength of money flowing in and out of a security. /// </summary> /// <returns></returns> public MFI MFI(Data.IDataSeries input, int period) { if (cacheMFI != null) { for (int idx = 0; idx < cacheMFI.Length; idx++) { if (cacheMFI[idx].Period == period && cacheMFI[idx].EqualsInput(input)) { return(cacheMFI[idx]); } } } lock (checkMFI) { checkMFI.Period = period; period = checkMFI.Period; if (cacheMFI != null) { for (int idx = 0; idx < cacheMFI.Length; idx++) { if (cacheMFI[idx].Period == period && cacheMFI[idx].EqualsInput(input)) { return(cacheMFI[idx]); } } } MFI indicator = new MFI(); 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(); MFI[] tmp = new MFI[cacheMFI == null ? 1 : cacheMFI.Length + 1]; if (cacheMFI != null) { cacheMFI.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheMFI = tmp; return(indicator); } }
/// <summary> /// The MFI (Money Flow Index) is a momentum indicator that measures the strength of money flowing in and out of a security. /// </summary> /// <returns></returns> public MFI MFI(Data.IDataSeries input, int period) { if (cacheMFI != null) for (int idx = 0; idx < cacheMFI.Length; idx++) if (cacheMFI[idx].Period == period && cacheMFI[idx].EqualsInput(input)) return cacheMFI[idx]; lock (checkMFI) { checkMFI.Period = period; period = checkMFI.Period; if (cacheMFI != null) for (int idx = 0; idx < cacheMFI.Length; idx++) if (cacheMFI[idx].Period == period && cacheMFI[idx].EqualsInput(input)) return cacheMFI[idx]; MFI indicator = new MFI(); 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(); MFI[] tmp = new MFI[cacheMFI == null ? 1 : cacheMFI.Length + 1]; if (cacheMFI != null) cacheMFI.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheMFI = tmp; return indicator; } }