public LBR3_10(DataSeries ds, int period1, int period2, string description) : base(ds, description) { base.FirstValidValue = Math.Max(period1, period2); Community.Indicators.FastSMA sma1 = Community.Indicators.FastSMA.Series(ds, period1); Community.Indicators.FastSMA sma2 = Community.Indicators.FastSMA.Series(ds, period2); for (int bar = FirstValidValue; bar < ds.Count; bar++) { base[bar] = sma1[bar] - sma2[bar]; } }
public static FastSMA Series(DataSeries ds, int period) { string description = string.Concat(new object[] { "Community.Indicators.FastSMA(", ds.Description, ",", period, ")" }); if (ds.Cache.ContainsKey(description)) { return((Community.Indicators.FastSMA)ds.Cache[description]); } Community.Indicators.FastSMA _SMA = new Community.Indicators.FastSMA(ds, period, description); ds.Cache[description] = _SMA; return(_SMA); }
public LBR3_10_Signal(DataSeries ds, int period1, int period2, int period3, string description) : base(ds, description) { base.FirstValidValue = Math.Max(period3, Math.Max(period1, period2)); LBR3_10 lbrOsc = new LBR3_10(ds, period1, period2, description); Community.Indicators.FastSMA sma = Community.Indicators.FastSMA.Series(lbrOsc, period3); for (int bar = FirstValidValue; bar < ds.Count; bar++) { base[bar] = sma[bar]; } }
public BBWidth(DataSeries ds, int period, double SD, bool percent, string description) : base(ds, description) { DataSeries BBUp = BBandUpper2.Series(ds, period, SD, StdDevCalculation.Sample); DataSeries BBDown = BBandLower2.Series(ds, period, SD, StdDevCalculation.Sample); Community.Indicators.FastSMA sma = Community.Indicators.FastSMA.Series(ds, period); DataSeries bbWidth = (BBUp - BBDown) / sma; //BandWidth = (upperBB − lowerBB) / middleBB base.FirstValidValue = ds.FirstValidValue; for (int bar = FirstValidValue; bar < ds.Count; bar++) { if (!percent) { base[bar] = bbWidth[bar]; } else { base[bar] = bbWidth[bar] * 100; } } }