use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class SimpleLinearRegressionIndicatorTest method setUp.
@Before
public void setUp() {
double[] data = new double[] { 10, 20, 30, 40, 30, 40, 30, 20, 30, 50, 60, 70, 80 };
closePrice = new ClosePriceIndicator(new MockTimeSeries(data));
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class PlusDMIndicatorTest method zeroDirectionalMovement3.
@Test
public void zeroDirectionalMovement3() {
MockBar yesterdayBar = new MockBar(0, 0, 6, 20);
MockBar todayBar = new MockBar(0, 0, 12, 4);
List<Bar> bars = new ArrayList<Bar>();
bars.add(yesterdayBar);
bars.add(todayBar);
MockTimeSeries series = new MockTimeSeries(bars);
PlusDMIndicator dup = new PlusDMIndicator(series);
assertDecimalEquals(dup.getValue(1), 0);
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class PlusDMIndicatorTest method positiveDirectionalMovement.
@Test
public void positiveDirectionalMovement() {
MockBar yesterdayBar = new MockBar(0, 0, 6, 6);
MockBar todayBar = new MockBar(0, 0, 12, 4);
List<Bar> bars = new ArrayList<Bar>();
bars.add(yesterdayBar);
bars.add(todayBar);
MockTimeSeries series = new MockTimeSeries(bars);
PlusDMIndicator dup = new PlusDMIndicator(series);
assertDecimalEquals(dup.getValue(1), 6);
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class PlusDMIndicatorTest method zeroDirectionalMovement2.
@Test
public void zeroDirectionalMovement2() {
MockBar yesterdayBar = new MockBar(0, 0, 6, 12);
MockBar todayBar = new MockBar(0, 0, 12, 6);
List<Bar> bars = new ArrayList<Bar>();
bars.add(yesterdayBar);
bars.add(todayBar);
MockTimeSeries series = new MockTimeSeries(bars);
PlusDMIndicator dup = new PlusDMIndicator(series);
assertDecimalEquals(dup.getValue(1), 0);
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class PriceVariationIndicatorTest method setUp.
@Before
public void setUp() {
timeSeries = new MockTimeSeries();
variationIndicator = new PriceVariationIndicator(timeSeries);
}
Aggregations