# Standard deviation of the difference between a time series and its EMA?

I have a time series $$Q={\{q_t\}}$$ of known standard deviation $$\sigma$$, and its EMA of parameter $$\alpha$$ : $$\{EMA_t(\alpha)\}$$.

My question is : I'm looking for a formula that would give the standard deviation $$\sigma_{\alpha}$$ of the time series made by the difference between $$Q$$ and its EMA for any $$\alpha$$, depending of the known Q standard deviation $$\sigma$$ : $$\sigma_{\alpha} = f_\sigma(\alpha) \space\space?$$

## Here is what I did so far

Intuitively, one could think that, the shorter is the EMA (= the closer is $$\alpha$$ to 1), the more it will fit the shape of the time series, so the less the stddev of the difference between the TS and its EMA, $$\sigma_\alpha$$, will be. Here is a time series with $$\sigma = 2.82$$ and their EMAs with different values for alpha to illustrate this intuition :

To get a further intuition of what that function could be, I plotted $$\sigma_\alpha$$ as a function of $$\alpha$$ :

As expected, when $$\alpha$$ is close to 0, $$\sigma_\alpha$$ approches $$\sigma$$ ; and when $$\alpha$$ is close to 1, the $$EMA = Q$$ : the standard deviation of the difference is naturally 0.

When I plot that with many different $$Q$$, this curve looks like pretty much the same, so it appears there is some deterministic function f, but I'm not able to find its expression. I plotted the derivative of $$f$$ for many different Q, and unfortunalty, it has a different shape depending on Q. Here are some plot of $$(\sigma_\alpha)'$$ :

In order to try to understand better the problem, I plotted $$\alpha_\sigma$$ and its derivative for a Q containing a very small number of points (4). The shape of f and its derivative looks now much more random... Here are $$\alpha_\sigma$$ and $$(\alpha_\sigma)'$$ for different Q containing 4 points :

So finally, it looks like the more the time series has points, the more $$f$$ will tend to be something deterministic. Though, I can't see intuitively what can be the missing information different than Q standard deviation $$\sigma$$ that make f stochastic, especially with a little number of points.

Am I missing some constant that I could compute from $$Q$$, whose depend an existing deterministic $$f$$ (appart from $$\sigma$$) ? Or is $$f$$ eventually stochastic and I can only have an estimation of $$\sigma_\alpha$$ by doing a regression ?

• Cross posted on Cross Validated: stats.stackexchange.com/questions/595338 Commented Nov 11, 2022 at 13:04
• I have a pair trading algorithm : I short when the spread is above its EMA, I long when it's under it. I'm currently trying to have an equation of the PnL/hour depending of the EMA alpha and other parameters. The idea is to get at least a good approximation of the PnL only by a formula and not by running the whole algorithm. This way, I'll be able to plot that PnL density in function of all the algo parameters (alpha is in them) and see where it maximizes :) The problem is that, atm, I need to run the algo which is very long if I were to do it with all the values of all algo parameters Commented Nov 11, 2022 at 13:04