Financial instruments fluctuate around their means. Sometimes the price of an instrument is above this instrument's mean, and sometimes the other way. Price tend to return to the mean. But can you use this mechanism for buying an selling financial instruments?

Let's check the most simple average-based rule on the S&P500 index over the previous 10,000 sessions.

**RULE: buy or short sell the index when the price deviates by X% from its mean.**

__Test 1: EMA=15, position holding period = 3__

Buying at deviation from the mean equal to -0.2 (20%) would bring nearly a 10% gain, but there was just one such situation over the whole period being analyzed:

t= -0.2 n= 1 avg= 0.09904726 min= 0.09904726 max= 0.09904726

Short term deviation doesn't look like a viable signal.

__Test 2: EMA=200, position holding period = 3__

No signals generated (testing only at 0.X, so 0.35 is not covered):

Large deviation from long term average does not influence short period movements.

__Test 3: EMA=200, position holding period = 25__

One weak signal: deviation = -0.3 increased probability of positive return. One could expect a 9,6% return, but there is also a risk of a loss of -7,1%.

t= -0.3 u= 13 d= 3 avg= 0.0964092 min= -0.07157303 max= 0.2284035

__Test 4: EMA=45, position holding period = 10__

Another case with weak signal. This time at deviation = -0.2.

t= -0.2 u= 8 d= 2 avg= 0.05415763 min= -0.02528302 max= 0.1521247

**Conclusion: Price deviations from the moving average (mean) "larger" than -0.2 significantly increase probability of an increase in price in the case of S&P500, but such deviations are rare events.**

UPDATE 1:

__Additional test: 35000+ quotations, MA=200, holding period = 25.__

Both "strong" and "weak" signal has been generated. Average expected return at each deviation added to the chart:

UPDATE 2:

It is getting to start getting more interesting when we consider long moving averages and long expected position holding period. Under such conditions, both the soft and hard signals give pretty solid expected gains with limited loss potential.

__Test: EMA=250, holding period=250__

soft signal:

t= -0.2 u= 178 d= 3 avg= 0.2415313 min= -0.1348127 max= 0.5206657

hard signal:

t= -0.3 n= 29 avg= 0.3260642 min= 0.1503819 max= 0.5206657

__Test: EMA=100, holding period=250__

t= -0.2 n= 41 avg= 0.2482144 min= 0.04344005 max= 0.5206657
UPDATE 3:

Measuring price deviation from moving average in terms of standard deviations makes the picture more messy:

__Test: SMA=250, holding period=250, deviation in terms of standard deviations:__