@Override
    public Num calculate(BarSeries series, Position position) {
        return calculateProfit(series, position);
    }
@Test
    public void calculateWithOpenedPosition() {
        MockBarSeries series = new MockBarSeries(numFunction, 100, 95, 100, 80, 85, 70);

        // with base percentage should return 1
        AnalysisCriterion retWithBase = getCriterion();
        Position position1 = new Position();
        assertNumEquals(1d, retWithBase.calculate(series, position1));
        position1.operate(0);
        assertNumEquals(1d, retWithBase.calculate(series, position1));

        // without base percentage should return 0
        AnalysisCriterion retWithoutBase = getCriterion(false);
        Position position2 = new Position();
        assertNumEquals(0, retWithoutBase.calculate(series, position2));
        position2.operate(0);
        assertNumEquals(0, retWithoutBase.calculate(series, position2));
    }