SMA Distance, Part I

Simple Moving Averages (SMA) have been used since time immemorial to trigger trading and risk-management decisions. They are also used to divide a time-series into different regimes to study derivative properties (volatility, for example.) One way to go about it is to simple split it based on whether the index is trading above an SMA or below it. But the binary split maybe too crude to model. Another way to go about it is to measure the percentage distance between the SMA and the index.

The distance

The formula is pretty simple: distance = SMA(n)/index -1 where n is the look-back period (50, 100, etc…)

If you vary n and plot the distance over time for the S&P 500, you get:
SP500.sma.distance
And the same thing for the NIFTY 50:
NIFTY50.sma.distance
-ve distance => Index > SMA (index is trending higher)

On the face of it, it looks like there is some pattern to it. The next post in this series will dive deeper into it. See Part II.

Code and charts are on github.