@Test public void calculateWithOneTrade() { BarSeries series = new MockBarSeries(numFunction, 100d, 95d, 102d, 105d, 97d, 113d); Trade trade = new Trade(Order.buyAt(0, series), Order.sellAt(1, series)); AnalysisCriterion average = getCriterion(); assertNumEquals(numOf(0), average.calculate(series, trade)); trade = new Trade(Order.buyAt(1, series), Order.sellAt(2, series)); assertNumEquals(1, average.calculate(series, trade)); }
@Override public Num calculate(BarSeries series, Trade trade) { return isProfitableTrade(series, trade) ? series.numOf(1) : series.numOf(0); }
AverageProfitableTradesCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return isProfitableTrade(series, trade) ? series.numOf(1) : series.numOf(0); } }
AverageProfitableTradesCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return isProfitableTrade(series, trade) ? series.numOf(1) : series.numOf(0); }  }
AverageProfitableTradesCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return isProfitableTrade(series, trade) ? series.numOf(1) : series.numOf(0); }  @Override Num calculate(BarSeries series, Trade trade); @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override boolean betterThan(Num criterionValue1, Num criterionValue2); }
AverageProfitableTradesCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return isProfitableTrade(series, trade) ? series.numOf(1) : series.numOf(0); }  @Override Num calculate(BarSeries series, Trade trade); @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override boolean betterThan(Num criterionValue1, Num criterionValue2);  }