public PBBandWidth(Bars bars, int period, string description) : base(bars, description) { base.FirstValidValue = period; PBandLower PBL = PBandLower.Series(bars, period); PBandUpper PBU = PBandUpper.Series(bars, period); for (int bar = FirstValidValue; bar < bars.Count; bar++) { base[bar] = 200 * (PBU[bar] - PBL[bar]) / (PBU[bar] + PBL[bar]); } }
public static PBandUpper Series(Bars bars, int period) { string description = string.Concat(new object[] { "Projection Band Upper(", period, ")" }); if (bars.Cache.ContainsKey(description)) { return((PBandUpper)bars.Cache[description]); } PBandUpper _PBandUpper = new PBandUpper(bars, period, description); bars.Cache[description] = _PBandUpper; return(_PBandUpper); }
public PBFastOsc(Bars bars, int period, int FSmooth, string description) : base(bars, description) { base.FirstValidValue = Math.Max(FSmooth, period) * 3; PBandLower PBL = PBandLower.Series(bars, period); PBandUpper PBU = PBandUpper.Series(bars, period); DataSeries A = bars.Close - PBL; DataSeries B = PBU - PBL; DataSeries Result = EMA.Series((A / B) * 100, FSmooth, EMACalculation.Modern); for (int bar = FirstValidValue; bar < bars.Count; bar++) { base[bar] = Result[bar]; } }