@Test public void test() { IndicatorsToChart.main(null); }
public static void main(String[] args) { BarSeries series = CsvBarsLoader.loadAppleIncSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); EMAIndicator avg14 = new EMAIndicator(closePrice, 14); StandardDeviationIndicator sd14 = new StandardDeviationIndicator(closePrice, 14); BollingerBandsMiddleIndicator middleBBand = new BollingerBandsMiddleIndicator(avg14); BollingerBandsLowerIndicator lowBBand = new BollingerBandsLowerIndicator(middleBBand, sd14); BollingerBandsUpperIndicator upBBand = new BollingerBandsUpperIndicator(middleBBand, sd14); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartBarSeries(series, closePrice, "Apple Inc. (AAPL) - NASDAQ GS")); dataset.addSeries(buildChartBarSeries(series, lowBBand, "Low Bollinger Band")); dataset.addSeries(buildChartBarSeries(series, upBBand, "High Bollinger Band")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Apple Inc. 2013 Close Prices", "Date", "Price Per Unit", dataset, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); displayChart(chart); }
IndicatorsToChart { public static void main(String[] args) { BarSeries series = CsvBarsLoader.loadAppleIncSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); EMAIndicator avg14 = new EMAIndicator(closePrice, 14); StandardDeviationIndicator sd14 = new StandardDeviationIndicator(closePrice, 14); BollingerBandsMiddleIndicator middleBBand = new BollingerBandsMiddleIndicator(avg14); BollingerBandsLowerIndicator lowBBand = new BollingerBandsLowerIndicator(middleBBand, sd14); BollingerBandsUpperIndicator upBBand = new BollingerBandsUpperIndicator(middleBBand, sd14); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartBarSeries(series, closePrice, "Apple Inc. (AAPL) - NASDAQ GS")); dataset.addSeries(buildChartBarSeries(series, lowBBand, "Low Bollinger Band")); dataset.addSeries(buildChartBarSeries(series, upBBand, "High Bollinger Band")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Apple Inc. 2013 Close Prices", "Date", "Price Per Unit", dataset, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); displayChart(chart); } }
IndicatorsToChart { public static void main(String[] args) { BarSeries series = CsvBarsLoader.loadAppleIncSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); EMAIndicator avg14 = new EMAIndicator(closePrice, 14); StandardDeviationIndicator sd14 = new StandardDeviationIndicator(closePrice, 14); BollingerBandsMiddleIndicator middleBBand = new BollingerBandsMiddleIndicator(avg14); BollingerBandsLowerIndicator lowBBand = new BollingerBandsLowerIndicator(middleBBand, sd14); BollingerBandsUpperIndicator upBBand = new BollingerBandsUpperIndicator(middleBBand, sd14); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartBarSeries(series, closePrice, "Apple Inc. (AAPL) - NASDAQ GS")); dataset.addSeries(buildChartBarSeries(series, lowBBand, "Low Bollinger Band")); dataset.addSeries(buildChartBarSeries(series, upBBand, "High Bollinger Band")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Apple Inc. 2013 Close Prices", "Date", "Price Per Unit", dataset, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); displayChart(chart); }  }
IndicatorsToChart { public static void main(String[] args) { BarSeries series = CsvBarsLoader.loadAppleIncSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); EMAIndicator avg14 = new EMAIndicator(closePrice, 14); StandardDeviationIndicator sd14 = new StandardDeviationIndicator(closePrice, 14); BollingerBandsMiddleIndicator middleBBand = new BollingerBandsMiddleIndicator(avg14); BollingerBandsLowerIndicator lowBBand = new BollingerBandsLowerIndicator(middleBBand, sd14); BollingerBandsUpperIndicator upBBand = new BollingerBandsUpperIndicator(middleBBand, sd14); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartBarSeries(series, closePrice, "Apple Inc. (AAPL) - NASDAQ GS")); dataset.addSeries(buildChartBarSeries(series, lowBBand, "Low Bollinger Band")); dataset.addSeries(buildChartBarSeries(series, upBBand, "High Bollinger Band")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Apple Inc. 2013 Close Prices", "Date", "Price Per Unit", dataset, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); displayChart(chart); }  static void main(String[] args); }
IndicatorsToChart { public static void main(String[] args) { BarSeries series = CsvBarsLoader.loadAppleIncSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); EMAIndicator avg14 = new EMAIndicator(closePrice, 14); StandardDeviationIndicator sd14 = new StandardDeviationIndicator(closePrice, 14); BollingerBandsMiddleIndicator middleBBand = new BollingerBandsMiddleIndicator(avg14); BollingerBandsLowerIndicator lowBBand = new BollingerBandsLowerIndicator(middleBBand, sd14); BollingerBandsUpperIndicator upBBand = new BollingerBandsUpperIndicator(middleBBand, sd14); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartBarSeries(series, closePrice, "Apple Inc. (AAPL) - NASDAQ GS")); dataset.addSeries(buildChartBarSeries(series, lowBBand, "Low Bollinger Band")); dataset.addSeries(buildChartBarSeries(series, upBBand, "High Bollinger Band")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Apple Inc. 2013 Close Prices", "Date", "Price Per Unit", dataset, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); displayChart(chart); }  static void main(String[] args);  }