what is the difference between moving average and regression It seems both of these two approaches are appropriate to reflect the change in a data series over time. The moving average uses a local window, but the regression uses a global window. Which one is better? Please describe their advantages and disadvantages.

At every time instant, moving average uses few past samples to calculate the moving average. It is a statistic to smooth out random short-term fluctuations in a data series. So, you use same variable past data to calculate same variable current data.
Regression on the other hand uses values of lot of other variables to predict the value of another variable. Variables used as input are called as independent variables, where as the output variable is called as dependent variable. There is no concept of time instant at all here.
Examples:
Moving Average: Stock Analysis, Temperature Analysis, Rainfall Analysis (all time data)
Regression: House Price Prediction, Cancer Prediction (no time data)
