BeginPackage["Wikicode`MovingAverage`"]
CompiledMovingAverage::usage = "CompiledMovingAverage[list,r] uses a \
compiled version of the standard function when the input is a list of \
reals."
Begin["`Private`"]
CompiledMovingAverage =
Compile[{{data, _Real, 1}, {len, _Integer}},
Module[{tot = Total[data[[1 ;; len - 1]]], last = 0.},
Table[tot = tot + data[[j + len]] - last; last = data[[j + 1]];
tot, {j, 0, Length[data] - len}]]/len]
End[]
EndPackage[]