public void RegressionChannelComputesCorrectly()
        {
            var period = 20;
            var indicator = new RegressionChannel(period, 2);
            var stdDev = new StandardDeviation(period);
            var time = DateTime.Now;

            var prices = LeastSquaresMovingAverageTest.prices;
            var expected = LeastSquaresMovingAverageTest.expected;

            var actual = new decimal[prices.Length];

            for (int i = 0; i < prices.Length; i++)
            {
                indicator.Update(time, prices[i]);
                stdDev.Update(time, prices[i]);
                actual[i] = Math.Round(indicator.Current.Value, 4);
                time = time.AddMinutes(1);
            }
            Assert.AreEqual(expected, actual);

            var expectedUpper = indicator.Current + stdDev.Current * 2;
            Assert.AreEqual(expectedUpper, indicator.UpperChannel);
            var expectedLower = indicator.Current - stdDev.Current * 2;
            Assert.AreEqual(expectedLower, indicator.LowerChannel);
        }
        public void ResetsProperly()
        {
            var period = 10;
            var time = DateTime.Now;

            var indicator = new RegressionChannel(period, 2);

            for (int i = 0; i < period + 1; i++)
            {
                indicator.Update(time, 1m);
                time.AddMinutes(1);
            }
            Assert.IsTrue(indicator.IsReady, "Regression Channel ready");
            indicator.Reset();
            TestHelper.AssertIndicatorIsInDefaultState(indicator);
        }