Beispiel #1
0
 /// <summary>
 /// Resets this indicator to its initial state
 /// </summary>
 public override void Reset()
 {
     base.Reset();
     MiddleBand.Reset();
     LowerBand.Reset();
     UpperBand.Reset();
 }
Beispiel #2
0
 /// <summary>
 /// Resets this indicator and all sub-indicators (StandardDeviation, LowerBand, MiddleBand, UpperBand)
 /// </summary>
 public override void Reset()
 {
     StandardDeviation.Reset();
     MiddleBand.Reset();
     UpperBand.Reset();
     LowerBand.Reset();
     base.Reset();
 }
Beispiel #3
0
 /// <summary>
 /// Resets this indicator to its initial state
 /// </summary>
 public override void Reset()
 {
     AverageTrueRange.Reset();
     MiddleBand.Reset();
     UpperBand.Reset();
     LowerBand.Reset();
     base.Reset();
 }
Beispiel #4
0
 /// <summary>
 ///      Resets this indicator to its initial state
 /// </summary>
 public override void Reset()
 {
     UpperBand.Reset();
     LowerBand.Reset();
     _previousInput = null;
     _previousTime  = 0;
     base.Reset();
 }
Beispiel #5
0
 /// <summary>
 /// Resets this indicator and all sub-indicators (StandardDeviation, LowerBand, MiddleBand, UpperBand, BandWidth, %B)
 /// </summary>
 public override void Reset()
 {
     StandardDeviation.Reset();
     MiddleBand.Reset();
     UpperBand.Reset();
     LowerBand.Reset();
     BandWidth.Reset();
     PercentB.Reset();
     base.Reset();
 }
Beispiel #6
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar > prevBar)
            {
                // NEW BAR PROCESSING
                prevBar = CurrentBar;
                if (barsToDisplay > 0 && prevBar > barsToDisplay)
                {
                    UpperBand.Reset(barsToDisplay);
                    LowerBand.Reset(barsToDisplay);
                    MidLine.Reset(barsToDisplay);
                }

                // midline
                var gv = newGaussVal(prevMedian, avgTotal);
                if (++curGaussIdx > poles)
                {
                    curGaussIdx = 0;
                }
                avg[curGaussIdx] = gv;
                avgTotal         = calcAvgTotal();
                prevMedian       = -1;

                // runerr
                devSum       = cdevSum;
                devs[curIdx] = cnewVal;
                if (++curIdx >= devLen)
                {
                    curIdx = 0;
                }

                // smooth bands
                ubema1 = cubema1;
                ubema2 = cubema2;
                ubema3 = cubema3;
                lbema1 = clbema1;
                lbema2 = clbema2;
                lbema3 = clbema3;
            }

            if (prevMedian != Median[0])
            {
                prevMedian = Median[0];
                // midline...
                var ngv = newGaussVal(prevMedian, avgTotal);

                // runerr...
                cnewVal = prevMedian - ngv;
                cnewVal = cnewVal * cnewVal;
                cdevSum = devSum - devs[curIdx] + cnewVal;
                var stdDev = numDevs * Math.Sqrt(Math.Max(cdevSum / devLen, 1e-10));

                // smooth bands...
                cubema1 = ubema1 + balpha1 * (ngv + stdDev - ubema1);
                cubema2 = ubema2 + balpha2 * (ngv + stdDev - ubema2);
                cubema3 = ubema3 + balpha3 * (cubema2 + cubema2 - cubema1 - ubema3);

                clbema1 = lbema1 + balpha1 * (ngv - stdDev - lbema1);
                clbema2 = lbema2 + balpha2 * (ngv - stdDev - lbema2);
                clbema3 = lbema3 + balpha3 * (clbema2 + clbema2 - clbema1 - lbema3);

                UpperBand.Set(cubema3);
                LowerBand.Set(clbema3);
                MidLine.Set(ngv);
            }
        }