public void ComparesAgainstExternalDataAfterReset()
        {
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);

            RunTestIndicator(dema);
            dema.Reset();
            RunTestIndicator(dema);
        }
Beispiel #2
0
 /// <summary>
 ///      Initializes a new instance of the <see cref="T3MovingAverage"/> class using the specified name and period.
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period of the T3MovingAverage</param>
 /// <param name="volumeFactor">The volume factor of the T3MovingAverage (value must be in the [0,1] range, defaults to 0.7)</param>
 public T3MovingAverage(string name, int period, double volumeFactor = 0.7d)
     : base(name)
 {
     _period = period;
     _gd1    = new DoubleExponentialMovingAverage(name + "_1", period, volumeFactor);
     _gd2    = new DoubleExponentialMovingAverage(name + "_2", period, volumeFactor);
     _gd3    = new DoubleExponentialMovingAverage(name + "_3", period, volumeFactor);
 }
        public void ResetsProperly()
        {
            var date = DateTime.Today;
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);
            foreach (var data in TestHelper.GetTradeBarStream("spy_dema.txt"))
            {
                dema.Update(date, data.Close);
            }

            Assert.IsTrue(dema.IsReady);

            dema.Reset();

            TestHelper.AssertIndicatorIsInDefaultState(dema);
        }
        public void ComparesAgainstExternalData()
        {
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);

            TestHelper.TestIndicator(dema, "spy_dema.txt", "DEMA_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-2));
        }
Beispiel #5
0
 private static void RunTestIndicator(DoubleExponentialMovingAverage dema)
 {
     TestHelper.TestIndicator(dema, "spy_dema.txt", "DEMA_5",
                              (ind, expected) => ((double)ind.Current.Price).Should().BeApproximately(expected, 1e-2));
 }
Beispiel #6
0
        public void ResetsProperly()
        {
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);

            TestHelper.TestIndicatorReset(dema, "spy_dema.txt");
        }
Beispiel #7
0
        public void ComparesAgainstExternalData()
        {
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);

            RunTestIndicator(dema);
        }
 private static void RunTestIndicator(DoubleExponentialMovingAverage dema)
 {
     TestHelper.TestIndicator(dema, "spy_dema.txt", "DEMA_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-2));
 }
 private static void RunTestIndicator(DoubleExponentialMovingAverage dema)
 {
     TestHelper.TestIndicator(dema, "spy_dema.txt", "DEMA_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-2));
 }
        public void ResetsProperly()
        {
            var dema = new DoubleExponentialMovingAverage("DEMA", 5);

            TestHelper.TestIndicatorReset(dema, "spy_dema.txt");
        }