use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class MMAIndicatorTest method mmaUsingTimeFrame10UsingClosePrice.
@Test
public void mmaUsingTimeFrame10UsingClosePrice() throws Exception {
Indicator<Decimal> actualIndicator = getIndicator(new ClosePriceIndicator(data), 10);
assertEquals(63.9983, actualIndicator.getValue(9).doubleValue(), TATestsUtils.TA_OFFSET);
assertEquals(63.7315, actualIndicator.getValue(10).doubleValue(), TATestsUtils.TA_OFFSET);
assertEquals(63.5093, actualIndicator.getValue(11).doubleValue(), TATestsUtils.TA_OFFSET);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class MMAIndicatorTest method firstValueShouldBeEqualsToFirstDataValue.
@Test
public void firstValueShouldBeEqualsToFirstDataValue() throws Exception {
Indicator<Decimal> actualIndicator = getIndicator(new ClosePriceIndicator(data), 1);
assertEquals(64.75, actualIndicator.getValue(0).doubleValue(), TATestsUtils.TA_OFFSET);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class RAVIIndicatorTest method ravi.
@Test
public void ravi() {
ClosePriceIndicator closePrice = new ClosePriceIndicator(data);
RAVIIndicator ravi = new RAVIIndicator(closePrice, 3, 8);
assertDecimalEquals(ravi.getValue(0), 0);
assertDecimalEquals(ravi.getValue(1), 0);
assertDecimalEquals(ravi.getValue(2), 0);
assertDecimalEquals(ravi.getValue(3), -0.6937);
assertDecimalEquals(ravi.getValue(4), -1.1411);
assertDecimalEquals(ravi.getValue(5), -0.1577);
assertDecimalEquals(ravi.getValue(6), 0.229);
assertDecimalEquals(ravi.getValue(7), 0.2412);
assertDecimalEquals(ravi.getValue(8), 0.1202);
assertDecimalEquals(ravi.getValue(9), -0.3324);
assertDecimalEquals(ravi.getValue(10), -0.5804);
assertDecimalEquals(ravi.getValue(11), 0.2013);
assertDecimalEquals(ravi.getValue(12), 1.6156);
assertDecimalEquals(ravi.getValue(13), 2.6167);
assertDecimalEquals(ravi.getValue(14), 4.0799);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class PercentBIndicatorTest method setUp.
@Before
public void setUp() {
TimeSeries data = new MockTimeSeries(10, 12, 15, 14, 17, 20, 21, 20, 20, 19, 20, 17, 12, 12, 9, 8, 9, 10, 9, 10);
closePrice = new ClosePriceIndicator(data);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class RSIIndicatorTest method hundredIfNoLoss.
@Test
public void hundredIfNoLoss() throws Exception {
Indicator<Decimal> indicator = getIndicator(new ClosePriceIndicator(data), 1);
assertEquals(Decimal.HUNDRED, indicator.getValue(14));
assertEquals(Decimal.HUNDRED, indicator.getValue(15));
}
Aggregations