Calculate a 6-month (126-business-day) centered moving average of a price:
SELECT TradeDate, AVG(Px) OVER (ORDER BY TradeDate ROWS BETWEEN 63 PRECEDING AND 63 FOLLOWING) AS PxMovingAverage
FROM HistoricalPrices
Note that, because it will take up to 63 rows before and after each returned row, at...