Ejemplo n.º 1
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar < 2)
            {
                MACD.Set(0);
                Smooth.Set(0);
                Hist.Set(0);
                return;
            }

            MACD.Set(fast[0] - slow[0]);
            Smooth.Set(Smooth[1] + 0.25 * (MACD[0] - Smooth[1]));
            Hist.Set(MACD[0] - Smooth[0]);
            if ((Hist[0] > Hist[1]) ||
                ((Hist[0] == Hist[1]) && (Hist[1] > Hist[2])))
            {
                PlotColors[2][0] = Color.MidnightBlue;
            }
        }