use of org.ta4j.core.TimeSeries 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);
}
use of org.ta4j.core.TimeSeries 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());
}
}
use of org.ta4j.core.TimeSeries 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);
}
use of org.ta4j.core.TimeSeries in project crypto-bot by jnidzwetzki.
the class DonchianBot method getUpperChannelValue.
/**
* Get the upper channel value
* @param currencyPair
* @return
*/
private Decimal getUpperChannelValue(final BitfinexCurrencyPair currencyPair) {
final TimeSeries currencyTimeSeries = timeSeries.get(currencyPair);
final MaxPriceIndicator maxPrice = new MaxPriceIndicator(currencyTimeSeries);
final DonchianChannelUpper donchianChannelUpper = new DonchianChannelUpper(maxPrice, periodIn);
return donchianChannelUpper.getValue(currencyTimeSeries.getEndIndex());
}
use of org.ta4j.core.TimeSeries in project crypto-bot by jnidzwetzki.
the class DonchianBot method getLowerChannelValue.
/**
* Get the lower channel value
* @param currencyPair
* @return
*/
private Decimal getLowerChannelValue(final BitfinexCurrencyPair currencyPair) {
final TimeSeries currencyTimeSeries = timeSeries.get(currencyPair);
final MinPriceIndicator minPrice = new MinPriceIndicator(currencyTimeSeries);
final DonchianChannelLower donchianChannelLower = new DonchianChannelLower(minPrice, periodOut);
return donchianChannelLower.getValue(currencyTimeSeries.getEndIndex());
}
Aggregations