Esempio n. 1
0
  @Test
  public void testLow() throws CalculationException {
    PriceIndicator priceIndicator = new PriceIndicator(dataProvider, PriceIndicator.PRICE_TYPE.LOW);

    for (int i = 0; i < lowPrices.length; i++) {
      Assert.assertEquals(priceIndicator.getValue(), lowPrices[i], 0.0001);
      dataProvider.nextBar();
    }
  }
Esempio n. 2
0
 @Test
 public void testMedianHighClose() throws CalculationException {
   PriceIndicator indicator =
       new PriceIndicator(dataProvider, PriceIndicator.PRICE_TYPE.MEDIAN_HIGH_CLOSE);
   for (int i = 0; i < openPrices.length; i++) {
     Double actual = indicator.getValue();
     double expected = (highPrices[i] + closePrices[i]) / 2.0;
     Assert.assertEquals(expected, actual, 0.0001);
     dataProvider.nextBar();
   }
 }