MA Style "Center"

I have been testing various MA setups and used the style “Center” in a script I’ve been developing.

In the Back Tester, all other styles produced an average win of 2-3% and success rate of 65-70%. “Center” produced an average win of 9.7% and a success rate of 98%. Nice, but I suspect something’s afoot.

Can anyone tell me what the “Center” style is and when it might be used?


Hi Kim,

Let me start by saying that it is very dangerous to use the Centered MA in a back test. It is a tool which can look forward and produce results which you would not have known about at the time.

Ok, in any other Moving Average we take the previous X number of values and we average them. We then repeat that for each new bar (hence the averaging “window” is moving as new data is added). I like to think of this calculation as immutable (can’t be changed). The issue is that the value is a measure of what has been in the past, so it lags what the market is doing. See the bottom chart in the image below.

A way that we can deal with that is to use a Centered Moving Average. In this one we have our “window” take half the observations behind us and half in-front of us. That way the average is taking into consideration the data on either side. This is easy when we process the history but not when we come up to the most recent bar since we no longer have any forward data. The only way we can deal with that is to drop the length of the centered moving average. This means that my average value for a particular bar can change as new data comes in (or, it’s variable).

When we do a back test, we take the whole history and calculate the signals, but the tools are based on the full history. That means they have the forward looking data. We do it this way to make the process faster and in 99.9% of cases, it is not an issue. With this tool (and pivots), it makes a big difference, and gives you false results. One day I want to build a “Deep Analysis” mode where it will be a lot slower but will process data bar by bar.

Bottom line for now, don’t use a centered MA (or pivots) in a back test.

Re when you would use a Centered MA? They are great for identifying cycles. In the top chart below you can see how it more closely tracks the prices. JM Hurst (A NASA scientist in the 70’s) used them in all his cycle work.

Hope that helps




Perfectly explained as usual - many thanks!!