@Override
    public Num calculate(BarSeries series, Position position) {
        final Num maxDrawdown = maxDrawdownCriterion.calculate(series, position);
        if (maxDrawdown.isZero()) {
            return NaN.NaN;
        } else {
            final Num totalProfit = grossReturnCriterion.calculate(series, position);
            return totalProfit.dividedBy(maxDrawdown);
        }
    }
@Test
    public void testNoDrawDownForTradingRecord() {
        final MockBarSeries series = new MockBarSeries(numFunction, 100, 105, 95, 100, 90, 95, 80, 120);
        final TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series), Trade.sellAt(1, series),
                Trade.buyAt(2, series), Trade.sellAt(3, series));

        final Num result = rrc.calculate(series, tradingRecord);

        assertNumEquals(NaN.NaN, result);
    }