Ejemplo n.º 1
0
        public MACD(IIndicator <double> source, int shortCycle, int longCycle, int difCycle)
        {
            Source     = source;
            ShortCycle = shortCycle;
            LongCycle  = longCycle;
            DifCycle   = difCycle;
            var fast = Source.EMA(ShortCycle);
            var slow = Source.EMA(LongCycle);

            Dif          = BinaryOperation.Create(fast, slow, (a, b) => a - b);
            Dea          = Dif.EMA(difCycle);
            Macd         = BinaryOperation.Create(Dif, Dea, (a, b) => 2 * (a - b));
            Dif.Update  += Merge;
            Dea.Update  += Merge;
            Macd.Update += Merge;
        }