/// <summary> /// The PFE (Polarized Fractal Efficiency) is an indicator that uses fractal geometry to determine how efficiently the price is moving. /// </summary> /// <returns></returns> public PFE PFE(Data.IDataSeries input, int period, int smooth) { if (cachePFE != null) { for (int idx = 0; idx < cachePFE.Length; idx++) { if (cachePFE[idx].Period == period && cachePFE[idx].Smooth == smooth && cachePFE[idx].EqualsInput(input)) { return(cachePFE[idx]); } } } lock (checkPFE) { checkPFE.Period = period; period = checkPFE.Period; checkPFE.Smooth = smooth; smooth = checkPFE.Smooth; if (cachePFE != null) { for (int idx = 0; idx < cachePFE.Length; idx++) { if (cachePFE[idx].Period == period && cachePFE[idx].Smooth == smooth && cachePFE[idx].EqualsInput(input)) { return(cachePFE[idx]); } } } PFE indicator = new PFE(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; indicator.Smooth = smooth; Indicators.Add(indicator); indicator.SetUp(); PFE[] tmp = new PFE[cachePFE == null ? 1 : cachePFE.Length + 1]; if (cachePFE != null) { cachePFE.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cachePFE = tmp; return(indicator); } }
/// <summary> /// The PFE (Polarized Fractal Efficiency) is an indicator that uses fractal geometry to determine how efficiently the price is moving. /// </summary> /// <returns></returns> public PFE PFE(Data.IDataSeries input, int period, int smooth) { if (cachePFE != null) for (int idx = 0; idx < cachePFE.Length; idx++) if (cachePFE[idx].Period == period && cachePFE[idx].Smooth == smooth && cachePFE[idx].EqualsInput(input)) return cachePFE[idx]; lock (checkPFE) { checkPFE.Period = period; period = checkPFE.Period; checkPFE.Smooth = smooth; smooth = checkPFE.Smooth; if (cachePFE != null) for (int idx = 0; idx < cachePFE.Length; idx++) if (cachePFE[idx].Period == period && cachePFE[idx].Smooth == smooth && cachePFE[idx].EqualsInput(input)) return cachePFE[idx]; PFE indicator = new PFE(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; indicator.Smooth = smooth; Indicators.Add(indicator); indicator.SetUp(); PFE[] tmp = new PFE[cachePFE == null ? 1 : cachePFE.Length + 1]; if (cachePFE != null) cachePFE.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cachePFE = tmp; return indicator; } }