public static MACDEx Series(DataSeries ds, int period1, int period2) { string description = string.Concat(new object[] { "MACDEx(", ds.Description, ",", period1, ",", period2, ")" }); if (ds.Cache.ContainsKey(description)) { return((MACDEx)ds.Cache[description]); } MACDEx _MACDEx = new MACDEx(ds, period1, period2, description); ds.Cache[description] = _MACDEx; return(_MACDEx); }
public MACDEx_Histogram3(DataSeries ds, int period1, int period2, int period3, string description) : base(ds, description) { base.FirstValidValue = Math.Max(period1, period2) * 3; if (FirstValidValue > ds.Count || FirstValidValue < 0) { FirstValidValue = ds.Count; } if (ds.Count < Math.Max(period1, period2)) { return; } MACDEx macdex = new MACDEx(ds, period1, period2, description); MACDEx_Signal3 sigLine = new MACDEx_Signal3(ds, period1, period2, period3, description); DataSeries macdHist = macdex - sigLine; for (int bar = FirstValidValue; bar < ds.Count; bar++) { base[bar] = macdHist[bar]; } }
public MACDEx_Signal3(DataSeries ds, int period1, int period2, int period3, string description) : base(ds, description) { base.FirstValidValue = Math.Max(period3, Math.Max(period1, period2)) * 3; if (FirstValidValue > ds.Count || FirstValidValue < 0) { FirstValidValue = ds.Count; } if (ds.Count < Math.Max(period1, period2)) { return; } EMACalculation m = EMACalculation.Modern; MACDEx macdex = new MACDEx(ds, period1, period2, description); EMA ema = EMA.Series(macdex, period3, m); for (int bar = FirstValidValue; bar < ds.Count; bar++) { base[bar] = ema[bar]; } }