@Override public Number[] targetShareData( SlidingPortfolioShare portfolioShare, Quotations stockQuotations, MInteger startDateQuotationIndex, MInteger endDateQuotationIndex) { if (arbitraryStartDate != null && arbitraryEndDate != null) { Date startDate = getStartDate(stockQuotations); startDateQuotationIndex.value = stockQuotations.getClosestIndexBeforeOrAtDateOrIndexZero(0, startDate); Date endDate = getEndDate(stockQuotations); endDateQuotationIndex.value = stockQuotations.getClosestIndexBeforeOrAtDateOrIndexZero( startDateQuotationIndex.value, endDate); BigDecimal investPerUnit = BigDecimal.ZERO; if (includeMoneyOut) { investPerUnit = portfolioShare.getPriceUnitCost( portfolioShare.calcSlidingEndDate(), portfolioShare.getTransactionCurrency()); } else { investPerUnit = portfolioShare.getPriceAvgBuy( portfolioShare.calcSlidingEndDate(), portfolioShare.getTransactionCurrency()); } return relativeCloses( stockQuotations, startDateQuotationIndex, endDateQuotationIndex, investPerUnit); } else { throw new InvalidParameterException(); } }