use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class BollingerBandsLowerIndicatorTest method setUp.
@Before
public void setUp() {
TimeSeries data = new MockTimeSeries(1, 2, 3, 4, 3, 4, 5, 4, 3, 3, 4, 3, 2);
timeFrame = 3;
closePrice = new ClosePriceIndicator(data);
sma = new SMAIndicator(closePrice, timeFrame);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class MeanDeviationIndicatorTest method meanDeviationUsingTimeFrame5UsingClosePrice.
@Test
public void meanDeviationUsingTimeFrame5UsingClosePrice() {
MeanDeviationIndicator meanDeviation = new MeanDeviationIndicator(new ClosePriceIndicator(data), 5);
assertDecimalEquals(meanDeviation.getValue(2), 2.44444444444444);
assertDecimalEquals(meanDeviation.getValue(3), 2.5);
assertDecimalEquals(meanDeviation.getValue(7), 2.16);
assertDecimalEquals(meanDeviation.getValue(8), 2.32);
assertDecimalEquals(meanDeviation.getValue(9), 2.72);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class MeanDeviationIndicatorTest method firstValueShouldBeZero.
@Test
public void firstValueShouldBeZero() {
MeanDeviationIndicator meanDeviation = new MeanDeviationIndicator(new ClosePriceIndicator(data), 5);
assertDecimalEquals(meanDeviation.getValue(0), 0);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class PeriodicalGrowthRateIndicatorTest method setUp.
@Before
public void setUp() {
TimeSeries mockSeries = new MockTimeSeries(29.49, 28.30, 27.74, 27.65, 27.60, 28.70, 28.60, 28.19, 27.40, 27.20, 27.28, 27.00, 27.59, 26.20, 25.75, 24.75, 23.33, 24.45, 24.25, 25.02, 23.60, 24.20, 24.28, 25.70, 25.46, 25.10, 25.00, 25.00, 25.85);
seriesManager = new TimeSeriesManager(mockSeries);
closePrice = new ClosePriceIndicator(mockSeries);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class SimpleLinearRegressionIndicatorTest method calculateLinearRegression.
@Test
public void calculateLinearRegression() {
double[] values = new double[] { 1, 2, 1.3, 3.75, 2.25 };
ClosePriceIndicator indicator = new ClosePriceIndicator(new MockTimeSeries(values));
SimpleLinearRegressionIndicator reg = new SimpleLinearRegressionIndicator(indicator, 5);
SimpleRegression origReg = buildSimpleRegression(values);
assertDecimalEquals(reg.getValue(4), origReg.predict(4));
}
Aggregations