@Override
    public Num calculate(BarSeries series, Position position) {
        return calculateProfit(series, position);
    }
@Test
    public void calculateWithWinningLongPositions() {
        MockBarSeries series = new MockBarSeries(numFunction, 100, 105, 110, 100, 95, 105);
        TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series), Trade.sellAt(2, series),
                Trade.buyAt(3, series), Trade.sellAt(5, series));

        // include base percentage
        AnalysisCriterion retWithBase = getCriterion();
        assertNumEquals(1.10 * 1.05, retWithBase.calculate(series, tradingRecord));

        // exclude base percentage
        AnalysisCriterion retWithoutBase = getCriterion(false);
        assertNumEquals(1.10 * 1.05 - 1, retWithoutBase.calculate(series, tradingRecord));
    }