moving average mapping function