@Test public void calculateWithOpenedTradeShouldReturn1() { MockTimeSeries series = new MockTimeSeries(100, 95, 100, 80, 85, 70); AnalysisCriterion profit = new TotalProfitCriterion(); Trade trade = new Trade(); assertEquals(1d, profit.calculate(series, trade), TATestsUtils.TA_OFFSET); trade.operate(0); assertEquals(1d, profit.calculate(series, trade), TATestsUtils.TA_OFFSET); }
@Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double value = 1d; for (Trade trade : tradingRecord.getTrades()) { value *= calculateProfit(series, trade); } return value; }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double value = 1d; for (Trade trade : tradingRecord.getTrades()) { value *= calculateProfit(series, trade); } return value; } }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double value = 1d; for (Trade trade : tradingRecord.getTrades()) { value *= calculateProfit(series, trade); } return value; }  }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double value = 1d; for (Trade trade : tradingRecord.getTrades()) { value *= calculateProfit(series, trade); } return value; }  @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override double calculate(TimeSeries series, Trade trade); @Override boolean betterThan(double criterionValue1, double criterionValue2); }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double value = 1d; for (Trade trade : tradingRecord.getTrades()) { value *= calculateProfit(series, trade); } return value; }  @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override double calculate(TimeSeries series, Trade trade); @Override boolean betterThan(double criterionValue1, double criterionValue2);  }