@Test public void calculateWithNoTicksShouldReturn1() { series = new MockTimeSeries(100, 95, 100, 80, 85, 70); AnalysisCriterion averageProfit = new AverageProfitCriterion(); assertEquals(1d, averageProfit.calculate(series, new BaseTradingRecord()), TATestsUtils.TA_OFFSET); }
@Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double ticks = numberOfTicks.calculate(series, tradingRecord); if (ticks == 0) { return 1; } return Math.pow(totalProfit.calculate(series, tradingRecord), 1d / ticks); }
AverageProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double ticks = numberOfTicks.calculate(series, tradingRecord); if (ticks == 0) { return 1; } return Math.pow(totalProfit.calculate(series, tradingRecord), 1d / ticks); } }
AverageProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double ticks = numberOfTicks.calculate(series, tradingRecord); if (ticks == 0) { return 1; } return Math.pow(totalProfit.calculate(series, tradingRecord), 1d / ticks); }  }
AverageProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double ticks = numberOfTicks.calculate(series, tradingRecord); if (ticks == 0) { return 1; } return Math.pow(totalProfit.calculate(series, tradingRecord), 1d / ticks); }  @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override double calculate(TimeSeries series, Trade trade); @Override boolean betterThan(double criterionValue1, double criterionValue2); }
AverageProfitCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, TradingRecord tradingRecord) { double ticks = numberOfTicks.calculate(series, tradingRecord); if (ticks == 0) { return 1; } return Math.pow(totalProfit.calculate(series, tradingRecord), 1d / ticks); }  @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override double calculate(TimeSeries series, Trade trade); @Override boolean betterThan(double criterionValue1, double criterionValue2);  }