Standard deviation calculations similar to what is described in the following link.
Chart number 2 and 3 reflect the following:
The key numbers to focus on are the columns titled 'STDEV from 50 Day and STDEV from 200 Day'. The figures show how many standard deviations various stock market indices are above the moving averages (red) or below the averages (green)."
See attached file.
In this example, I used S&P adjusted closes (column B). You could of course replace these with ...
This solution discusses standard deviation and moving averages.