use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class BearishHaramiIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// open, close, high, low
bars.add(new MockBar(10, 18, 20, 10));
bars.add(new MockBar(15, 18, 19, 14));
bars.add(new MockBar(17, 16, 19, 15));
bars.add(new MockBar(15, 11, 15, 8));
bars.add(new MockBar(11, 12, 12, 10));
series = new MockTimeSeries(bars);
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class BullishEngulfingIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// open, close, high, low
bars.add(new MockBar(10, 18, 20, 10));
bars.add(new MockBar(17, 16, 19, 15));
bars.add(new MockBar(15, 18, 19, 14));
bars.add(new MockBar(15, 11, 15, 8));
bars.add(new MockBar(11, 12, 12, 10));
series = new MockTimeSeries(bars);
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class DojiIndicatorTest method getValueAtIndex0.
@Test
public void getValueAtIndex0() {
DojiIndicator doji = new DojiIndicator(new MockTimeSeries(0d), 10, Decimal.valueOf("0.03"));
assertTrue(doji.getValue(0));
doji = new DojiIndicator(new MockTimeSeries(1d), 10, Decimal.valueOf("0.03"));
assertFalse(doji.getValue(0));
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class TimeSeriesManagerTest method runOnWholeSeriesWithAmount.
@Test
public void runOnWholeSeriesWithAmount() {
TimeSeries series = new MockTimeSeries(20d, 40d, 60d, 10d, 30d, 50d, 0d, 20d, 40d);
manager.setTimeSeries(series);
List<Trade> allTrades = manager.run(strategy, OrderType.BUY, Decimal.HUNDRED).getTrades();
assertEquals(2, allTrades.size());
assertEquals(Decimal.HUNDRED, allTrades.get(0).getEntry().getAmount());
assertEquals(Decimal.HUNDRED, allTrades.get(1).getEntry().getAmount());
}
use of org.ta4j.core.mocks.MockTimeSeries in project ta4j by ta4j.
the class CloseLocationValueIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// open, close, high, low
bars.add(new MockBar(10, 18, 20, 10));
bars.add(new MockBar(17, 20, 21, 17));
bars.add(new MockBar(15, 15, 16, 14));
bars.add(new MockBar(15, 11, 15, 8));
bars.add(new MockBar(11, 12, 12, 10));
series = new MockTimeSeries(bars);
}
Aggregations