Exemplo n.º 1
0
        public void getBarWithRemovedIndexOnMovingSeriesShouldReturnFirstRemainingBar()
        {
            IBar bar = defaultSeries.GetBar(4);

            defaultSeries.SetMaximumBarCount(2);

            Assert.AreEqual(bar, defaultSeries.GetBar(0));
            Assert.AreEqual(bar, defaultSeries.GetBar(1));
            Assert.AreEqual(bar, defaultSeries.GetBar(2));
            Assert.AreEqual(bar, defaultSeries.GetBar(3));
            Assert.AreEqual(bar, defaultSeries.GetBar(4));
            Assert.AreNotEqual(bar, defaultSeries.GetBar(5));
        }
Exemplo n.º 2
0
        public void recursiveCachedIndicatorOnMovingTimeSeriesShouldNotCauseStackOverflow()
        {
            // Added to check issue #120: https://github.com/mdeverdelhan/ta4j/issues/120
            // See also: CachedIndicator#getValue(int index)
            series = new MockTimeSeries();
            series.SetMaximumBarCount(5);
            Assert.AreEqual(5, series.GetBarCount());

            ZLEMAIndicator zlema = new ZLEMAIndicator(new ClosePriceIndicator(series), 1);

            Assert.AreEqual(zlema.GetValue(8), 4996);
        }
Exemplo n.º 3
0
 public void maximumBarCountOnConstrainedSeriesShouldThrowException()
 {
     Assert.ThrowsException <NotSupportedException>(() => constrainedSeries.SetMaximumBarCount(10));
 }