def _calculate_values_to_forecast(self, timeSeries):
        if self._forecastUntil is None:
            return
        if not timeSeries.is_sorted():
            raise ValueError("timeSeries has to be sorted.")
        if not timeSeries.is_normalized():
            raise ValueError("timeSeries has to be normalized.")
        timediff = timeSeries[-1][0] - timeSeries[-2][0]
        forecastSpan = self._forecastUntil - timeSeries[-1][0]
        self.set_parameter("valuesToForecast", int(forecastSpan / timediff) + 1)