use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class CorrelationCoefficientIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class CovarianceIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class MeanDeviationIndicatorTest method meanDeviationShouldBeZeroWhenTimeFrameIs1.
@Test
public void meanDeviationShouldBeZeroWhenTimeFrameIs1() {
MeanDeviationIndicator meanDeviation = new MeanDeviationIndicator(new ClosePriceIndicator(data), 1);
assertDecimalEquals(meanDeviation.getValue(2), 0);
assertDecimalEquals(meanDeviation.getValue(7), 0);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class PearsonCorrelationIndicatorTest method setUp.
@Before
public void setUp() {
List<Bar> bars = new ArrayList<Bar>();
// close, volume
bars.add(new MockBar(6, 100));
bars.add(new MockBar(7, 105));
bars.add(new MockBar(9, 130));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(11, 150));
bars.add(new MockBar(10, 130));
bars.add(new MockBar(11, 95));
bars.add(new MockBar(13, 120));
bars.add(new MockBar(15, 180));
bars.add(new MockBar(12, 160));
bars.add(new MockBar(8, 150));
bars.add(new MockBar(4, 200));
bars.add(new MockBar(3, 150));
bars.add(new MockBar(4, 85));
bars.add(new MockBar(3, 70));
bars.add(new MockBar(5, 90));
bars.add(new MockBar(8, 100));
bars.add(new MockBar(9, 95));
bars.add(new MockBar(11, 110));
bars.add(new MockBar(10, 95));
TimeSeries data = new BaseTimeSeries(bars);
close = new ClosePriceIndicator(data);
volume = new VolumeIndicator(data, 2);
}
use of org.ta4j.core.indicators.helpers.ClosePriceIndicator in project ta4j by ta4j.
the class SigmaIndicatorTest method test.
@Test
public void test() {
SigmaIndicator zScore = new SigmaIndicator(new ClosePriceIndicator(data), 5);
assertDecimalEquals(zScore.getValue(1), 1.0);
assertDecimalEquals(zScore.getValue(2), 1.224744871391589);
assertDecimalEquals(zScore.getValue(3), 1.34164078649987387);
assertDecimalEquals(zScore.getValue(4), 1.414213562373095);
assertDecimalEquals(zScore.getValue(5), 1.414213562373095);
}
Aggregations