Example #1
0
        public void shouldBePreviousValueFromIndicator()
        {
            //test 1 with openPrice-indicator
            prevValueIndicator = new PreviousValueIndicator(openPriceIndicator);
            Assert.AreEqual(prevValueIndicator.GetValue(0), openPriceIndicator.GetValue(0));
            for (int i = 1; i < this.series.GetBarCount(); i++)
            {
                Assert.AreEqual(prevValueIndicator.GetValue(i), openPriceIndicator.GetValue(i - 1));
            }

            //test 2 with minPrice-indicator
            prevValueIndicator = new PreviousValueIndicator(minPriceIndicator);
            Assert.AreEqual(prevValueIndicator.GetValue(0), minPriceIndicator.GetValue(0));
            for (int i = 1; i < this.series.GetBarCount(); i++)
            {
                Assert.AreEqual(prevValueIndicator.GetValue(i), minPriceIndicator.GetValue(i - 1));
            }

            //test 3 with maxPrice-indicator
            prevValueIndicator = new PreviousValueIndicator(maxPriceIndicator);
            Assert.AreEqual(prevValueIndicator.GetValue(0), maxPriceIndicator.GetValue(0));
            for (int i = 1; i < this.series.GetBarCount(); i++)
            {
                Assert.AreEqual(prevValueIndicator.GetValue(i), maxPriceIndicator.GetValue(i - 1));
            }
        }
Example #2
0
 public void IndicatorShouldRetrieveTickOpenPrice()
 {
     for (var i = 0; i < 10; i++)
     {
         Assert.AreEqual(_openPriceIndicator.GetValue(i), _timeSeries.GetTick(i).OpenPrice);
     }
 }
 public void indicatorShouldRetrieveBarOpenPrice()
 {
     for (int i = 0; i < 10; i++)
     {
         Assert.AreEqual(openPriceIndicator.GetValue(i), timeSeries.GetBar(i).OpenPrice);
     }
 }