## 1 Introduction  
Time series analysis has been applied in a wide range of practical problems such as financial market prediction [1], electric utility load forecasting [2], as well as weather and environmental state prediction [3; 4; 5; 6]. As it is rather difficult to estimate the exact values of time series, recent studies have mostly paid attention to judging the trend of time series in the future. Typically, time series prediction can be cast as a classification problem in which the goal is to predict the future movement direction of time series, e.g., the rising, falling, and steady trends. As one of the most popular technical indicators in time series analysis, moving average indicators can summarize the overall changing patterns of time series over a past period in a simple and quick way [7]. Although widely used in different applications, traditional moving average indicators are calculated by averaging the data from different time steps with equal or predefined weights. However, the equal weighting scheme cannot reflect the difference in the importance of different time steps, while manually determining the weights requires a considerable amount of domain knowledge and engineering skills. In addition, unchanged data weights will be applied across different time series, regardless of the differences in their inherent characteristics. Generally, we can perform time series prediction by comparing the moving averages at different scales. For example, in the stock market, the short-term moving average crosses upward or falls below the long-term moving average, which are usually regardedas rising and falling signals, respectively, [8]. However, such strategies are still heuristic rules, ignoring the influence of the interaction between the moving average dimensions of different scales, and how to make better use of multi-scale moving averages for time series prediction remains an open question. To address the above problems, in this paper, we propose a learning-based moving average indicator, called the self-attentive moving average (\(SAMA\)). Specifically, after encoding the input signals of time series based on recurrent neural networks (RNNs), we introduce the self-attention mechanism [9] to adaptively determine the data weight at each time step for calculating moving averages. In addition, we use multiple self-attention heads to model the moving average indicators of different scales. The bilinear model considers the interaction between the moving average dimensions of different scales and provides a richer representation than the linear model. Numerous studies [10; 11; 12] have proved its effectiveness in different fields, and we designed a bilinear fusion sub-network to integrate them for effective time series prediction in an end-to-end manner. Extensive experiments on two real-world datasets validate the rationality of combining multi-scale \(SAMA\) indicators, and show that our method significantly outperforms traditional moving average indicators as well as the modern sequential modeling methods for time series prediction. The data and codes of our work are accessible at [[https://github.com/YY-Susan/SAMA](https://github.com/YY-Susan/SAMA)]([https://github.com/YY-Susan/SAMA](https://github.com/YY-Susan/SAMA)) (accessed on 28 February 2022). In summary, the main contributions of our work are:  
* We present a novel learning-based moving average indicator that introduces the self-attention mechanism to adaptively determine the data weight at each time step. * We use multiple self-attention heads to model the moving average indicators of different scales and use bilinear models to effectively combine them for time series prediction in an end-to-end manner. * We conduct the experimental evaluation on two real-world datasets and the results demonstrate the effectiveness of our approach. The remainder of the paper is organized as follows. Section 2 reviews the related work. Section 3 introduces some methodological background regarding moving average indicators.