示例#1
0
        public static MACDEx_Signal3 Series(DataSeries ds, int period1, int period2, int period3)
        {
            string description = string.Concat(new object[] { "MACDEx Signal(", ds.Description, ",", period1, ",", period2, ",", period3, ")" });

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

            MACDEx_Signal3 _MACDEx_Signal = new MACDEx_Signal3(ds, period1, period2, period3, description);

            ds.Cache[description] = _MACDEx_Signal;
            return(_MACDEx_Signal);
        }
示例#2
0
        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];
            }
        }