/** * @param x The array of price time series. The first time series should be the price; any other * arrays are assumed to be a timeseries of dividend payments. * @return The exponential weighted historical volatility * @throws IllegalArgumentException If x is null, empty or if the first element of the array is * null; if the number of values in the time series is less than three; if the dates in the * different time series do not coincide */ @Override public Double evaluate(final LocalDateDoubleTimeSeries... x) { testTimeSeries(x, 3); final LocalDateDoubleTimeSeries returnTS = _returnCalculator.evaluate(x); final Iterator<Double> iter = returnTS.valuesIterator(); double returnValue = iter.next(); double variance = returnValue * returnValue; while (iter.hasNext()) { returnValue = iter.next(); variance = _lambda * variance + _lambdaM1 * returnValue * returnValue; } return Math.sqrt(variance); }