Correct a bug about unmatched shapes of arrays
Add moving average calculation