use of org.ta4j.core.indicators.helpers.MinPriceIndicator in project ta4j by ta4j.
the class WilliamsRIndicatorTest method williamsRUsingTimeFrame5UsingClosePrice.
@Test
public void williamsRUsingTimeFrame5UsingClosePrice() {
WilliamsRIndicator wr = new WilliamsRIndicator(new ClosePriceIndicator(data), 5, new MaxPriceIndicator(data), new MinPriceIndicator(data));
assertDecimalEquals(wr.getValue(4), -47.2222);
assertDecimalEquals(wr.getValue(5), -54.5454);
assertDecimalEquals(wr.getValue(6), -78.5714);
assertDecimalEquals(wr.getValue(7), -47.6190);
assertDecimalEquals(wr.getValue(8), -25d);
assertDecimalEquals(wr.getValue(9), -5.2632);
assertDecimalEquals(wr.getValue(10), -13.9535);
}
use of org.ta4j.core.indicators.helpers.MinPriceIndicator 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());
}
use of org.ta4j.core.indicators.helpers.MinPriceIndicator in project ta4j by ta4j.
the class WilliamsRIndicatorTest method williamsRUsingTimeFrame10UsingClosePrice.
@Test
public void williamsRUsingTimeFrame10UsingClosePrice() {
WilliamsRIndicator wr = new WilliamsRIndicator(new ClosePriceIndicator(data), 10, new MaxPriceIndicator(data), new MinPriceIndicator(data));
assertDecimalEquals(wr.getValue(9), -4.0816);
assertDecimalEquals(wr.getValue(10), -11.7647);
assertDecimalEquals(wr.getValue(11), -8.9286);
assertDecimalEquals(wr.getValue(12), -10.5263);
}
use of org.ta4j.core.indicators.helpers.MinPriceIndicator in project ta4j by ta4j.
the class WilliamsRIndicatorTest method valueLessThenTimeFrame.
@Test
public void valueLessThenTimeFrame() {
WilliamsRIndicator wr = new WilliamsRIndicator(new ClosePriceIndicator(data), 100, new MaxPriceIndicator(data), new MinPriceIndicator(data));
assertDecimalEquals(wr.getValue(0), -100d * (0.12 / 0.21));
assertDecimalEquals(wr.getValue(1), -100d * (0.07 / 0.21));
assertDecimalEquals(wr.getValue(2), -100d * (0.13 / 0.36));
assertDecimalEquals(wr.getValue(3), -100d * (0.18 / 0.36));
}
Aggregations