By means of a novel time-dependent cumulated variation penalty function, a new class of real-time prediction methods is developed to improve the prediction accuracy of time series exhibiting irregular periodic patterns: in particular, the breathing motion data of the patients during robotic radiation therapy. It is illustrated that for both simulated and empirical data involving changes in mean, trend, and amplitude, the proposed methods outperform existing forecasting methods based on support vector machines and artificial neural network in terms of prediction accuracy. Moreover, the proposed methods are designed so that real-time updates can be done efficiently with O(1) computational complexity upon the arrival of a new signal without scanning the old data repeatedly.