A genetic programming approach to time series forecasting