use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.
the class CorrelationCoefficientIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.
the class CovarianceIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.
the class PearsonCorrelationIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.mocks.MockBar 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.MockBar 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);
}
Aggregations