Ejemplo n.º 1
0
        public MACDEx_Histogram(Bars bars, DataSeries ds, int period1, int period2, string description)
            : base(bars, description)
        {
            this.bars = bars;
            this.ds = ds;
            this.period1 = period1;
            this.period2 = period2;
            base.FirstValidValue = Math.Max(period1, period2) * 3;
            MACDEx macdex = new MACDEx(bars, ds, period1, period2, description);
            MACDEx_Signal sigLine = new MACDEx_Signal(bars, ds, period1, period2, description);
            DataSeries macdHist = macdex - sigLine;

            for (int bar = FirstValidValue; bar < bars.Count; bar++)
            {
                base[bar] = macdHist[bar];
            }
        }
Ejemplo n.º 2
0
        public MACDEx_Signal(Bars bars, DataSeries ds, int period1, int period2, string description)
            : base(bars, description)
        {
            this.bars = bars;
            this.ds = ds;
            this.period1 = period1;
            this.period2 = period2;
            base.FirstValidValue = Math.Max(9, Math.Max(period1, period2)) * 3;
            EMACalculation m = EMACalculation.Modern;
            MACDEx macdex = new MACDEx(bars, ds, period1, period2, description);
            EMA ema = EMA.Series(macdex, 9, m);

            for (int bar = FirstValidValue; bar < bars.Count; bar++)
            {
                base[bar] = ema[bar];
            }
        }
Ejemplo n.º 3
0
        public static MACDEx Series(Bars bars, DataSeries ds, int period1, int period2)
        {
            string description = string.Concat(new object[] { "MACDEx(", bars.Symbol, ",", ds.Description, ",", period1, ",", period2, ")" });
            //string description = string.Concat(new object[] { "MACDEx(", bars.ToString(), ",", ds.Description, ",", period1, ",", period2, ")" });

            if (bars.Cache.ContainsKey(description))
            {
                return (MACDEx)bars.Cache[description];
            }

            MACDEx _MACDEx = new MACDEx(bars, ds, period1, period2, description);
            bars.Cache[description] = _MACDEx;
            return _MACDEx;
        }