use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.
the class MinusDMIndicatorTest method positiveDirectionalMovement.
@Test
public void positiveDirectionalMovement() {
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);
MinusDMIndicator down = new MinusDMIndicator(series);
assertDecimalEquals(down.getValue(1), 16);
}
use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.
the class VWAPIndicatorTest method setUp.
@Before
public void setUp() {
// @TODO add volumes
List<Bar> bars = new ArrayList<Bar>();
bars.add(new MockBar(44.98, 45.05, 45.17, 44.96));
bars.add(new MockBar(45.05, 45.10, 45.15, 44.99));
bars.add(new MockBar(45.11, 45.19, 45.32, 45.11));
bars.add(new MockBar(45.19, 45.14, 45.25, 45.04));
bars.add(new MockBar(45.12, 45.15, 45.20, 45.10));
bars.add(new MockBar(45.15, 45.14, 45.20, 45.10));
bars.add(new MockBar(45.13, 45.10, 45.16, 45.07));
bars.add(new MockBar(45.12, 45.15, 45.22, 45.10));
bars.add(new MockBar(45.15, 45.22, 45.27, 45.14));
bars.add(new MockBar(45.24, 45.43, 45.45, 45.20));
bars.add(new MockBar(45.43, 45.44, 45.50, 45.39));
bars.add(new MockBar(45.43, 45.55, 45.60, 45.35));
bars.add(new MockBar(45.58, 45.55, 45.61, 45.39));
bars.add(new MockBar(45.45, 45.01, 45.55, 44.80));
bars.add(new MockBar(45.03, 44.23, 45.04, 44.17));
bars.add(new MockBar(44.23, 43.95, 44.29, 43.81));
bars.add(new MockBar(43.91, 43.08, 43.99, 43.08));
bars.add(new MockBar(43.07, 43.55, 43.65, 43.06));
bars.add(new MockBar(43.56, 43.95, 43.99, 43.53));
bars.add(new MockBar(43.93, 44.47, 44.58, 43.93));
data = new MockTimeSeries(bars);
}
Aggregations