Search in sources :

Example 51 with MockBar

use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.

the class ThreeWhiteSoldiersIndicatorTest method setUp.

@Before
public void setUp() {
    List<Bar> bars = new ArrayList<Bar>();
    // open, close, high, low
    bars.add(new MockBar(19, 19, 22, 15));
    bars.add(new MockBar(10, 18, 20, 8));
    bars.add(new MockBar(17, 16, 21, 15));
    bars.add(new MockBar(15.6, 18, 18.1, 14));
    bars.add(new MockBar(16, 19.9, 20, 15));
    bars.add(new MockBar(16.8, 23, 23, 16.7));
    bars.add(new MockBar(17, 25, 25, 17));
    bars.add(new MockBar(23, 16.8, 24, 15));
    series = new MockTimeSeries(bars);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) Bar(org.ta4j.core.Bar) MockBar(org.ta4j.core.mocks.MockBar) ArrayList(java.util.ArrayList) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) Before(org.junit.Before)

Example 52 with MockBar

use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.

the class UpperShadowIndicatorTest 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);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) Bar(org.ta4j.core.Bar) MockBar(org.ta4j.core.mocks.MockBar) ArrayList(java.util.ArrayList) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) Before(org.junit.Before)

Example 53 with MockBar

use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.

the class MinusDMIndicatorTest method zeroDirectionalMovement.

@Test
public void zeroDirectionalMovement() {
    MockBar yesterdayBar = new MockBar(0, 0, 10, 2);
    MockBar todayBar = new MockBar(0, 0, 6, 6);
    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), 0);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) Bar(org.ta4j.core.Bar) MockBar(org.ta4j.core.mocks.MockBar) ArrayList(java.util.ArrayList) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) Test(org.junit.Test)

Example 54 with MockBar

use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.

the class MinusDMIndicatorTest 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);
    MinusDMIndicator down = new MinusDMIndicator(series);
    assertDecimalEquals(down.getValue(1), 0);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) Bar(org.ta4j.core.Bar) MockBar(org.ta4j.core.mocks.MockBar) ArrayList(java.util.ArrayList) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) Test(org.junit.Test)

Example 55 with MockBar

use of org.ta4j.core.mocks.MockBar in project ta4j by ta4j.

the class MinusDMIndicatorTest method zeroDirectionalMovement3.

@Test
public void zeroDirectionalMovement3() {
    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);
    MinusDMIndicator down = new MinusDMIndicator(series);
    assertDecimalEquals(down.getValue(1), 0);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) Bar(org.ta4j.core.Bar) MockBar(org.ta4j.core.mocks.MockBar) ArrayList(java.util.ArrayList) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) Test(org.junit.Test)

Aggregations

MockBar (org.ta4j.core.mocks.MockBar)57 ArrayList (java.util.ArrayList)54 Bar (org.ta4j.core.Bar)48 MockTimeSeries (org.ta4j.core.mocks.MockTimeSeries)46 Before (org.junit.Before)35 Test (org.junit.Test)22 BaseTimeSeries (org.ta4j.core.BaseTimeSeries)6 TimeSeries (org.ta4j.core.TimeSeries)5 ClosePriceIndicator (org.ta4j.core.indicators.helpers.ClosePriceIndicator)5 ZonedDateTime (java.time.ZonedDateTime)3 VolumeIndicator (org.ta4j.core.indicators.helpers.VolumeIndicator)3 BaseTradingRecord (org.ta4j.core.BaseTradingRecord)1 TradingRecord (org.ta4j.core.TradingRecord)1 FixedRule (org.ta4j.core.trading.rules.FixedRule)1