@Override
    public boolean isSatisfied(int index, TradingRecord tradingRecord) {
        if (tradingRecord.getCurrentPosition().isOpened()) {
            final int entryIndex = tradingRecord.getLastEntry().getIndex();
            final int currentBarCount = index - entryIndex;
            return currentBarCount >= barCount;
        }
        return false;
    }
@Test
    public void testAtLeastOneBarRuleForOpenedTrade() {
        final OpenedPositionMinimumBarCountRule rule = new OpenedPositionMinimumBarCountRule(1);

        final BarSeries series = new MockBarSeries(DecimalNum::valueOf, 1, 2, 3, 4);

        final TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series));

        assertFalse(rule.isSatisfied(0, tradingRecord));
        assertTrue(rule.isSatisfied(1, tradingRecord));
        assertTrue(rule.isSatisfied(2, tradingRecord));
        assertTrue(rule.isSatisfied(3, tradingRecord));
    }