Search in sources :

Example 81 with ClosePriceIndicator

use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.

the class KeltnerChannelLowerIndicatorTest method keltnerChannelLowerIndicatorTest.

@Test
public void keltnerChannelLowerIndicatorTest() {
    KeltnerChannelMiddleIndicator km = new KeltnerChannelMiddleIndicator(new ClosePriceIndicator(data), 14);
    KeltnerChannelLowerIndicator kl = new KeltnerChannelLowerIndicator(km, Decimal.valueOf(2), 14);
    assertDecimalEquals(kl.getValue(13), 11556.5468);
    assertDecimalEquals(kl.getValue(14), 11583.7971);
    assertDecimalEquals(kl.getValue(15), 11610.8331);
    assertDecimalEquals(kl.getValue(16), 11639.5955);
    assertDecimalEquals(kl.getValue(17), 11667.0877);
    assertDecimalEquals(kl.getValue(18), 11660.5619);
    assertDecimalEquals(kl.getValue(19), 11675.8782);
    assertDecimalEquals(kl.getValue(20), 11705.9497);
    assertDecimalEquals(kl.getValue(21), 11726.7208);
    assertDecimalEquals(kl.getValue(22), 11753.4154);
    assertDecimalEquals(kl.getValue(23), 11781.8375);
    assertDecimalEquals(kl.getValue(24), 11817.1476);
    assertDecimalEquals(kl.getValue(25), 11851.9771);
    assertDecimalEquals(kl.getValue(26), 11878.6139);
    assertDecimalEquals(kl.getValue(27), 11904.4570);
    assertDecimalEquals(kl.getValue(28), 11935.3907);
    assertDecimalEquals(kl.getValue(29), 11952.2012);
}
Also used : ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Test(org.junit.Test)

Aggregations

ClosePriceIndicator (org.ta4j.core.indicators.helpers.ClosePriceIndicator)81 Test (org.junit.Test)55 MockTimeSeries (org.ta4j.core.mocks.MockTimeSeries)26 TimeSeries (org.ta4j.core.TimeSeries)16 Before (org.junit.Before)14 SMAIndicator (org.ta4j.core.indicators.SMAIndicator)7 OverIndicatorRule (org.ta4j.core.trading.rules.OverIndicatorRule)6 ArrayList (java.util.ArrayList)5 TimeSeriesCollection (org.jfree.data.time.TimeSeriesCollection)5 MockBar (org.ta4j.core.mocks.MockBar)5 UnderIndicatorRule (org.ta4j.core.trading.rules.UnderIndicatorRule)5 SimpleDateFormat (java.text.SimpleDateFormat)4 JFreeChart (org.jfree.chart.JFreeChart)4 DateAxis (org.jfree.chart.axis.DateAxis)4 XYPlot (org.jfree.chart.plot.XYPlot)4 EMAIndicator (org.ta4j.core.indicators.EMAIndicator)4 CrossedDownIndicatorRule (org.ta4j.core.trading.rules.CrossedDownIndicatorRule)4 BaseStrategy (org.ta4j.core.BaseStrategy)3 Decimal (org.ta4j.core.Decimal)3 MaxPriceIndicator (org.ta4j.core.indicators.helpers.MaxPriceIndicator)3