In this paper we propose a data driven method to select the fitting sample of neural networks for time series forecasting. In spite of the fundamental importance of sample selection for model building there has been limited research in the forecasting literature, mostly concluding in vague recommendations on how much time series history should be used and stored. This research addresses this issue in a data driven framework. The proposed method allows the neural networks to iteratively adjust the fitting sample, penalizing the time series history for age and inconsistent behavior. The resulting selected sample helps the networks to produce accurate out-of-sample forecasts, focusing on the recent history of the time series. The performance of the method is demonstrated using time series from different domains, exhibiting substantial improvements in accuracy.