public void UsingTimeFrame5UsingClosePriceAndVolume()
        {
            var covar = new CovarianceIndicator(_close, _volume, 5);

            TaTestsUtils.AssertDecimalEquals(covar.GetValue(0), 0);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(1), 26.25);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(2), 63.3333);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(3), 143.75);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(4), 156);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(5), 60.8);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(6), 15.2);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(7), -17.6);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(8), 4);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(9), 11.6);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(10), -14.4);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(11), -100.2);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(12), -70.0);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(13), 24.6);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(14), 35.0);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(15), -19.0);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(16), -47.8);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(17), 11.4);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(18), 55.8);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(19), 33.4);
        }
        public void ShouldBeZeroWhenTimeFrameIs1()
        {
            var covar = new CovarianceIndicator(_close, _volume, 1);

            TaTestsUtils.AssertDecimalEquals(covar.GetValue(3), 0);
            TaTestsUtils.AssertDecimalEquals(covar.GetValue(8), 0);
        }
示例#3
0
        public void usingTimeFrame5UsingClosePriceAndVolume()
        {
            CovarianceIndicator covar = new CovarianceIndicator(close, volume, 5);

            Assert.AreEqual(covar.GetValue(0), 0M);
            Assert.AreEqual(covar.GetValue(1), 26.25M);
            Assert.AreEqual(covar.GetValue(2), 63.333333333333333333333333333M);
            Assert.AreEqual(covar.GetValue(3), 143.75M);
            Assert.AreEqual(covar.GetValue(4), 156M);
            Assert.AreEqual(covar.GetValue(5), 60.8M);
            Assert.AreEqual(covar.GetValue(6), 15.2M);
            Assert.AreEqual(covar.GetValue(7), -17.6M);
            Assert.AreEqual(covar.GetValue(8), 4M);
            Assert.AreEqual(covar.GetValue(9), 11.6M);
            Assert.AreEqual(covar.GetValue(10), -14.4M);
            Assert.AreEqual(covar.GetValue(11), -100.2M);
            Assert.AreEqual(covar.GetValue(12), -70.0M);
            Assert.AreEqual(covar.GetValue(13), 24.6M);
            Assert.AreEqual(covar.GetValue(14), 35.0M);
            Assert.AreEqual(covar.GetValue(15), -19.0M);
            Assert.AreEqual(covar.GetValue(16), -47.8M);
            Assert.AreEqual(covar.GetValue(17), 11.4M);
            Assert.AreEqual(covar.GetValue(18), 55.8M);
            Assert.AreEqual(covar.GetValue(19), 33.4M);
        }
示例#4
0
        public void shouldBeZeroWhenTimeFrameIs1()
        {
            CovarianceIndicator covar = new CovarianceIndicator(close, volume, 1);

            Assert.AreEqual(covar.GetValue(3), 0);
            Assert.AreEqual(covar.GetValue(8), 0);
        }
示例#5
0
 /// <summary>
 /// Constructor. </summary>
 /// <param name="indicator1"> the first indicator </param>
 /// <param name="indicator2"> the second indicator </param>
 /// <param name="timeFrame"> the time frame </param>
 public CorrelationCoefficientIndicator(IIndicator <Decimal> indicator1, IIndicator <Decimal> indicator2, int timeFrame) : base(indicator1)
 {
     _variance1  = new VarianceIndicator(indicator1, timeFrame);
     _variance2  = new VarianceIndicator(indicator2, timeFrame);
     _covariance = new CovarianceIndicator(indicator1, indicator2, timeFrame);
 }
        public void FirstValueShouldBeZero()
        {
            var covar = new CovarianceIndicator(_close, _volume, 5);

            TaTestsUtils.AssertDecimalEquals(covar.GetValue(0), 0);
        }
示例#7
0
        public void firstValueShouldBeZero()
        {
            CovarianceIndicator covar = new CovarianceIndicator(close, volume, 5);

            Assert.AreEqual(covar.GetValue(0), 0);
        }