Search in sources :

Example 51 with MockTimeSeries

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

the class BollingerBandWidthIndicatorTest method setUp.

@Before
public void setUp() {
    TimeSeries data = new MockTimeSeries(10, 12, 15, 14, 17, 20, 21, 20, 20, 19, 20, 17, 12, 12, 9, 8, 9, 10, 9, 10);
    closePrice = new ClosePriceIndicator(data);
}
Also used : TimeSeries(org.ta4j.core.TimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Before(org.junit.Before)

Example 52 with MockTimeSeries

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

the class BollingerBandsUpperIndicatorTest method setUp.

@Before
public void setUp() {
    TimeSeries data = new MockTimeSeries(1, 2, 3, 4, 3, 4, 5, 4, 3, 3, 4, 3, 2);
    timeFrame = 3;
    closePrice = new ClosePriceIndicator(data);
    sma = new SMAIndicator(closePrice, timeFrame);
}
Also used : SMAIndicator(org.ta4j.core.indicators.SMAIndicator) TimeSeries(org.ta4j.core.TimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Before(org.junit.Before)

Example 53 with MockTimeSeries

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

the class KAMAIndicatorTest method getValueOnDeepIndicesShouldNotCauseStackOverflow.

@Test
public void getValueOnDeepIndicesShouldNotCauseStackOverflow() {
    TimeSeries series = new MockTimeSeries();
    series.setMaximumBarCount(5000);
    assertEquals(5000, series.getBarCount());
    KAMAIndicator kama = new KAMAIndicator(new ClosePriceIndicator(series), 10, 2, 30);
    try {
        assertDecimalEquals(kama.getValue(3000), "2999.75");
    } catch (Throwable t) {
        fail(t.getMessage());
    }
}
Also used : TimeSeries(org.ta4j.core.TimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Test(org.junit.Test)

Example 54 with MockTimeSeries

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

the class PercentBIndicatorTest method setUp.

@Before
public void setUp() {
    TimeSeries data = new MockTimeSeries(10, 12, 15, 14, 17, 20, 21, 20, 20, 19, 20, 17, 12, 12, 9, 8, 9, 10, 9, 10);
    closePrice = new ClosePriceIndicator(data);
}
Also used : TimeSeries(org.ta4j.core.TimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) MockTimeSeries(org.ta4j.core.mocks.MockTimeSeries) ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Before(org.junit.Before)

Example 55 with MockTimeSeries

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

the class BearishEngulfingIndicatorTest 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(21, 15, 22, 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)

Aggregations

MockTimeSeries (org.ta4j.core.mocks.MockTimeSeries)135 Test (org.junit.Test)90 MockBar (org.ta4j.core.mocks.MockBar)46 ArrayList (java.util.ArrayList)45 Before (org.junit.Before)45 Bar (org.ta4j.core.Bar)42 TimeSeries (org.ta4j.core.TimeSeries)29 ClosePriceIndicator (org.ta4j.core.indicators.helpers.ClosePriceIndicator)25 BaseTradingRecord (org.ta4j.core.BaseTradingRecord)17 TradingRecord (org.ta4j.core.TradingRecord)12 ZonedDateTime (java.time.ZonedDateTime)5 AnalysisCriterion (org.ta4j.core.AnalysisCriterion)3 BaseStrategy (org.ta4j.core.BaseStrategy)3 ExternalCriterionTest (org.ta4j.core.ExternalCriterionTest)3 Strategy (org.ta4j.core.Strategy)3 Decimal (org.ta4j.core.Decimal)2 TimeSeriesManager (org.ta4j.core.TimeSeriesManager)2 Trade (org.ta4j.core.Trade)2 SMAIndicator (org.ta4j.core.indicators.SMAIndicator)2 FixedRule (org.ta4j.core.trading.rules.FixedRule)2