@Override
    public Num calculate(BarSeries series, Position position) {
        Num profitLossRatio = profitLossRatioCriterion.calculate(series, position);
        Num numberOfPositions = numberOfPositionsCriterion.calculate(series, position);
        Num numberOfWinningPositions = numberOfWinningPositionsCriterion.calculate(series, position);
        return calculate(series, profitLossRatio, numberOfWinningPositions, numberOfPositions);
    }
@Test
    public void calculateWithMixedPositions() {
        MockBarSeries series = new MockBarSeries(numFunction, 100, 110, 80, 130, 150, 160);
        TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series), Trade.sellAt(2, series),
                Trade.buyAt(3, series), Trade.sellAt(5, series));

        AnalysisCriterion avgLoss = getCriterion();
        assertNumEquals(0.25, avgLoss.calculate(series, tradingRecord));
    }