コード例 #1
0
ファイル: zMaMacd.cs プロジェクト: Sandy4321/NinjaIndicators
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			var macdval = ma1.next(Input[0]) - ma2.next(Input[0]);
			trigger = trigger + alpha*(macdval - trigger);
            MACD.Set(macdval);
            Hist.Set(scale*(macdval-trigger));
        }
コード例 #2
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;
            }
        }