@Test public void test() { IndicatorsToCsv.main(null); }
public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); TypicalPriceIndicator typicalPrice = new TypicalPriceIndicator(series); PriceVariationIndicator priceVariation = new PriceVariationIndicator(series); SMAIndicator shortSma = new SMAIndicator(closePrice, 8); SMAIndicator longSma = new SMAIndicator(closePrice, 20); EMAIndicator shortEma = new EMAIndicator(closePrice, 8); EMAIndicator longEma = new EMAIndicator(closePrice, 20); PPOIndicator ppo = new PPOIndicator(closePrice, 12, 26); ROCIndicator roc = new ROCIndicator(closePrice, 100); RSIIndicator rsi = new RSIIndicator(closePrice, 14); WilliamsRIndicator williamsR = new WilliamsRIndicator(series, 20); ATRIndicator atr = new ATRIndicator(series, 20); StandardDeviationIndicator sd = new StandardDeviationIndicator(closePrice, 14); StringBuilder sb = new StringBuilder( "timestamp,close,typical,variation,sma8,sma20,ema8,ema20,ppo,roc,rsi,williamsr,atr,sd\n"); final int nbBars = series.getBarCount(); for (int i = 0; i < nbBars; i++) { sb.append(series.getBar(i).getEndTime()).append(',').append(closePrice.getValue(i)).append(',') .append(typicalPrice.getValue(i)).append(',').append(priceVariation.getValue(i)).append(',') .append(shortSma.getValue(i)).append(',').append(longSma.getValue(i)).append(',') .append(shortEma.getValue(i)).append(',').append(longEma.getValue(i)).append(',') .append(ppo.getValue(i)).append(',').append(roc.getValue(i)).append(',').append(rsi.getValue(i)) .append(',').append(williamsR.getValue(i)).append(',').append(atr.getValue(i)).append(',') .append(sd.getValue(i)).append('\n'); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File("target", "indicators.csv"))); writer.write(sb.toString()); } catch (IOException ioe) { Logger.getLogger(IndicatorsToCsv.class.getName()).log(Level.SEVERE, "Unable to write CSV file", ioe); } finally { try { if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }
IndicatorsToCsv { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); TypicalPriceIndicator typicalPrice = new TypicalPriceIndicator(series); PriceVariationIndicator priceVariation = new PriceVariationIndicator(series); SMAIndicator shortSma = new SMAIndicator(closePrice, 8); SMAIndicator longSma = new SMAIndicator(closePrice, 20); EMAIndicator shortEma = new EMAIndicator(closePrice, 8); EMAIndicator longEma = new EMAIndicator(closePrice, 20); PPOIndicator ppo = new PPOIndicator(closePrice, 12, 26); ROCIndicator roc = new ROCIndicator(closePrice, 100); RSIIndicator rsi = new RSIIndicator(closePrice, 14); WilliamsRIndicator williamsR = new WilliamsRIndicator(series, 20); ATRIndicator atr = new ATRIndicator(series, 20); StandardDeviationIndicator sd = new StandardDeviationIndicator(closePrice, 14); StringBuilder sb = new StringBuilder( "timestamp,close,typical,variation,sma8,sma20,ema8,ema20,ppo,roc,rsi,williamsr,atr,sd\n"); final int nbBars = series.getBarCount(); for (int i = 0; i < nbBars; i++) { sb.append(series.getBar(i).getEndTime()).append(',').append(closePrice.getValue(i)).append(',') .append(typicalPrice.getValue(i)).append(',').append(priceVariation.getValue(i)).append(',') .append(shortSma.getValue(i)).append(',').append(longSma.getValue(i)).append(',') .append(shortEma.getValue(i)).append(',').append(longEma.getValue(i)).append(',') .append(ppo.getValue(i)).append(',').append(roc.getValue(i)).append(',').append(rsi.getValue(i)) .append(',').append(williamsR.getValue(i)).append(',').append(atr.getValue(i)).append(',') .append(sd.getValue(i)).append('\n'); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File("target", "indicators.csv"))); writer.write(sb.toString()); } catch (IOException ioe) { Logger.getLogger(IndicatorsToCsv.class.getName()).log(Level.SEVERE, "Unable to write CSV file", ioe); } finally { try { if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } } }
IndicatorsToCsv { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); TypicalPriceIndicator typicalPrice = new TypicalPriceIndicator(series); PriceVariationIndicator priceVariation = new PriceVariationIndicator(series); SMAIndicator shortSma = new SMAIndicator(closePrice, 8); SMAIndicator longSma = new SMAIndicator(closePrice, 20); EMAIndicator shortEma = new EMAIndicator(closePrice, 8); EMAIndicator longEma = new EMAIndicator(closePrice, 20); PPOIndicator ppo = new PPOIndicator(closePrice, 12, 26); ROCIndicator roc = new ROCIndicator(closePrice, 100); RSIIndicator rsi = new RSIIndicator(closePrice, 14); WilliamsRIndicator williamsR = new WilliamsRIndicator(series, 20); ATRIndicator atr = new ATRIndicator(series, 20); StandardDeviationIndicator sd = new StandardDeviationIndicator(closePrice, 14); StringBuilder sb = new StringBuilder( "timestamp,close,typical,variation,sma8,sma20,ema8,ema20,ppo,roc,rsi,williamsr,atr,sd\n"); final int nbBars = series.getBarCount(); for (int i = 0; i < nbBars; i++) { sb.append(series.getBar(i).getEndTime()).append(',').append(closePrice.getValue(i)).append(',') .append(typicalPrice.getValue(i)).append(',').append(priceVariation.getValue(i)).append(',') .append(shortSma.getValue(i)).append(',').append(longSma.getValue(i)).append(',') .append(shortEma.getValue(i)).append(',').append(longEma.getValue(i)).append(',') .append(ppo.getValue(i)).append(',').append(roc.getValue(i)).append(',').append(rsi.getValue(i)) .append(',').append(williamsR.getValue(i)).append(',').append(atr.getValue(i)).append(',') .append(sd.getValue(i)).append('\n'); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File("target", "indicators.csv"))); writer.write(sb.toString()); } catch (IOException ioe) { Logger.getLogger(IndicatorsToCsv.class.getName()).log(Level.SEVERE, "Unable to write CSV file", ioe); } finally { try { if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }  }
IndicatorsToCsv { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); TypicalPriceIndicator typicalPrice = new TypicalPriceIndicator(series); PriceVariationIndicator priceVariation = new PriceVariationIndicator(series); SMAIndicator shortSma = new SMAIndicator(closePrice, 8); SMAIndicator longSma = new SMAIndicator(closePrice, 20); EMAIndicator shortEma = new EMAIndicator(closePrice, 8); EMAIndicator longEma = new EMAIndicator(closePrice, 20); PPOIndicator ppo = new PPOIndicator(closePrice, 12, 26); ROCIndicator roc = new ROCIndicator(closePrice, 100); RSIIndicator rsi = new RSIIndicator(closePrice, 14); WilliamsRIndicator williamsR = new WilliamsRIndicator(series, 20); ATRIndicator atr = new ATRIndicator(series, 20); StandardDeviationIndicator sd = new StandardDeviationIndicator(closePrice, 14); StringBuilder sb = new StringBuilder( "timestamp,close,typical,variation,sma8,sma20,ema8,ema20,ppo,roc,rsi,williamsr,atr,sd\n"); final int nbBars = series.getBarCount(); for (int i = 0; i < nbBars; i++) { sb.append(series.getBar(i).getEndTime()).append(',').append(closePrice.getValue(i)).append(',') .append(typicalPrice.getValue(i)).append(',').append(priceVariation.getValue(i)).append(',') .append(shortSma.getValue(i)).append(',').append(longSma.getValue(i)).append(',') .append(shortEma.getValue(i)).append(',').append(longEma.getValue(i)).append(',') .append(ppo.getValue(i)).append(',').append(roc.getValue(i)).append(',').append(rsi.getValue(i)) .append(',').append(williamsR.getValue(i)).append(',').append(atr.getValue(i)).append(',') .append(sd.getValue(i)).append('\n'); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File("target", "indicators.csv"))); writer.write(sb.toString()); } catch (IOException ioe) { Logger.getLogger(IndicatorsToCsv.class.getName()).log(Level.SEVERE, "Unable to write CSV file", ioe); } finally { try { if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }  static void main(String[] args); }
IndicatorsToCsv { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); ClosePriceIndicator closePrice = new ClosePriceIndicator(series); TypicalPriceIndicator typicalPrice = new TypicalPriceIndicator(series); PriceVariationIndicator priceVariation = new PriceVariationIndicator(series); SMAIndicator shortSma = new SMAIndicator(closePrice, 8); SMAIndicator longSma = new SMAIndicator(closePrice, 20); EMAIndicator shortEma = new EMAIndicator(closePrice, 8); EMAIndicator longEma = new EMAIndicator(closePrice, 20); PPOIndicator ppo = new PPOIndicator(closePrice, 12, 26); ROCIndicator roc = new ROCIndicator(closePrice, 100); RSIIndicator rsi = new RSIIndicator(closePrice, 14); WilliamsRIndicator williamsR = new WilliamsRIndicator(series, 20); ATRIndicator atr = new ATRIndicator(series, 20); StandardDeviationIndicator sd = new StandardDeviationIndicator(closePrice, 14); StringBuilder sb = new StringBuilder( "timestamp,close,typical,variation,sma8,sma20,ema8,ema20,ppo,roc,rsi,williamsr,atr,sd\n"); final int nbBars = series.getBarCount(); for (int i = 0; i < nbBars; i++) { sb.append(series.getBar(i).getEndTime()).append(',').append(closePrice.getValue(i)).append(',') .append(typicalPrice.getValue(i)).append(',').append(priceVariation.getValue(i)).append(',') .append(shortSma.getValue(i)).append(',').append(longSma.getValue(i)).append(',') .append(shortEma.getValue(i)).append(',').append(longEma.getValue(i)).append(',') .append(ppo.getValue(i)).append(',').append(roc.getValue(i)).append(',').append(rsi.getValue(i)) .append(',').append(williamsR.getValue(i)).append(',').append(atr.getValue(i)).append(',') .append(sd.getValue(i)).append('\n'); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File("target", "indicators.csv"))); writer.write(sb.toString()); } catch (IOException ioe) { Logger.getLogger(IndicatorsToCsv.class.getName()).log(Level.SEVERE, "Unable to write CSV file", ioe); } finally { try { if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }  static void main(String[] args);  }