Ejemplo n.º 1
0
        public static MACDEx_Signal Series(DataSeries ds, int period1, int period2)
        {
            string description = string.Concat(new object[] { "MACDEx Signal(", ds.Description, ",", period1, ",", period2, ")" });

            if (ds.Cache.ContainsKey(description))
            {
                return((MACDEx_Signal)ds.Cache[description]);
            }

            MACDEx_Signal _MACDEx_Signal = new MACDEx_Signal(ds, period1, period2, description);

            ds.Cache[description] = _MACDEx_Signal;
            return(_MACDEx_Signal);
        }
Ejemplo n.º 2
0
        public MACDEx_Histogram(DataSeries ds, int period1, int period2, 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_Signal sigLine  = new MACDEx_Signal(ds, period1, period2, description);
            DataSeries    macdHist = macdex - sigLine;

            for (int bar = FirstValidValue; bar < ds.Count; bar++)
            {
                base[bar] = macdHist[bar];
            }
        }