@Test public void calculate() { BarSeries series = new MockBarSeries(numFunction, 100d, 95d, 102d, 105d, 97d, 113d); TradingRecord tradingRecord = new BaseTradingRecord(Order.buyAt(0, series), Order.sellAt(1, series), Order.buyAt(2, series), Order.sellAt(3, series), Order.buyAt(4, series), Order.sellAt(5, series)); AnalysisCriterion average = getCriterion(); assertNumEquals(2d / 3, average.calculate(series, tradingRecord)); }
@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);  }