Exemple #1
0
        public RollingBB(string name)
            : base(name)
        {
            BB           = new BollingerBands(20, 2, MovingAverageType.Exponential);
            WarmUpPeriod = 20 * 2;

            LB = new RollingWindow <decimal>(20);
            UB = new RollingWindow <decimal>(20);
        }
Exemple #2
0
        public void ResetsProperly()
        {
            var bb = new BollingerBands(2, 2m);
            bb.Update(DateTime.Today, 1m);

            Assert.IsFalse(bb.IsReady);
            bb.Update(DateTime.Today.AddSeconds(1), 2m);
            Assert.IsTrue(bb.IsReady);
            Assert.IsTrue(bb.StandardDeviation.IsReady);
            Assert.IsTrue(bb.LowerBand.IsReady);
            Assert.IsTrue(bb.MiddleBand.IsReady);
            Assert.IsTrue(bb.UpperBand.IsReady);

            bb.Reset();
            TestHelper.AssertIndicatorIsInDefaultState(bb);
            TestHelper.AssertIndicatorIsInDefaultState(bb.StandardDeviation);
            TestHelper.AssertIndicatorIsInDefaultState(bb.LowerBand);
            TestHelper.AssertIndicatorIsInDefaultState(bb.MiddleBand);
            TestHelper.AssertIndicatorIsInDefaultState(bb.UpperBand);
        }
Exemple #3
0
 public void ComparesWithExternalDataLowerBand()
 {
     var bb = new BollingerBands(20, 2.0m, MovingAverageType.Simple);
     TestHelper.TestIndicator(bb, "spy_bollinger_bands.txt", "Bollinger Bands® 20 2 Bottom", (BollingerBands ind) => (double)ind.LowerBand.Current.Value);
 }