@Override
    public Num calculate(BarSeries series, Position position) {
        return criterion.calculate(series, position).dividedBy(enterAndHoldCriterion.calculate(series, position));
    }
@Test
    public void calculateWithAverageProfit() {
        MockBarSeries series = new MockBarSeries(numFunction, 100, 95, 100, 80, 85, 130);
        TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, NaN, NaN), Trade.sellAt(1, NaN, NaN),
                Trade.buyAt(2, NaN, NaN), Trade.sellAt(5, NaN, NaN));

        AnalysisCriterion buyAndHold = getCriterion(new AverageReturnPerBarCriterion());

        assertNumEquals(Math.pow(95d / 100 * 130d / 100, 1d / 6) / Math.pow(130d / 100, 1d / 6),
                buyAndHold.calculate(series, tradingRecord));
    }