/// <summary>
        /// Called on each bar update event (incoming tick).
        /// </summary>
        protected override void OnBarUpdate()
        {
            diff.Set(High[0] - Low[0]);

            double middle = EMA(Typical, Period)[0];
            double offset = EMA(diff, Period)[0] * offsetMultiplier;

            double upper = middle + offset;
            double lower = middle - offset;

            Midline.Set(middle);
            Upper.Set(upper);
            Lower.Set(lower);

            if (Rising(Midline))
            {
                PlotColors[1][0] = upColor;
                PlotColors[2][0] = upColor;
            }
            if (Falling(Midline))
            {
                PlotColors[1][0] = dnColor;
                PlotColors[2][0] = dnColor;
            }
        }
예제 #2
0
        /// <summary>
        /// Called on each bar update event (incoming tick).
        /// </summary>
        protected override void OnBarUpdate()
        {
            diff.Set(High[0] - Low[0]);

            double middle = SMA(Typical, Period)[0];
            double offset = SMA(diff, Period)[0] * offsetMultiplier;

            double upper = middle + offset;
            double lower = middle - offset;

            Midline.Set(middle);
            Upper.Set(upper);
            Lower.Set(lower);
        }