I need to calculate 12 day EMA for stocks closing prices. I have checked out the solution proposed by Gordon Linoff in this link: SQL - Calculate Exponential Moving Average