@Override
    public Num calculate(BarSeries series, Position position) {
        return isConsecutive(position) ? series.one() : series.zero();
    }
@Test
    public void calculateWithOneLongPosition() {
        MockBarSeries seriesLoss = new MockBarSeries(numFunction, 110, 105, 100, 90, 95, 105);
        Position positionLoss = new Position(Trade.buyAt(1, seriesLoss), Trade.sellAt(3, seriesLoss));
        assertNumEquals(1, getCriterion(PositionFilter.LOSS).calculate(seriesLoss, positionLoss));

        MockBarSeries seriesProfit = new MockBarSeries(numFunction, 100, 105, 110, 120, 95, 105);
        Position positionProfit = new Position(Trade.buyAt(1, seriesProfit), Trade.sellAt(3, seriesProfit));
        assertNumEquals(1, getCriterion(PositionFilter.PROFIT).calculate(seriesProfit, positionProfit));
    }