From theory to practice - page 192

 
Alexander_K2:

So, just take the WMA, exponential weights and get the EMA? According to the formulas, it's different.

No, they are not. But it's a long story.


 
Alexander_K2 So I'm figuring out the EMA, I'll program it myself and try it out.

I bet $100 that with a three year backtest, there will be no difference with SMA)))

 
Alexander_K2:

There is no such concept there at all. There are classical ones - median, arithmetic mean and weighted average.

That's why I'm dealing with EMA, I'll program it myself and try it out.

If you set exponential weights instead of distribution weights in WMA, you will get EMA.

And if you set a linearly decreasing series of weights, you get LWMA.

 
bas:

I bet $100 that with a three year backtest, there will be no difference with SMA)))

!00 quid I don't bet because I don't know reliably what it will do. But in this interpretation the EMA won't pass). Or maybe with similar results to SMA.

 
Yuriy Asaulenko:

!00 quid I don't bet, because I don't know reliably what it will do. But in this interpretation the EMA will not pass). Or maybe with similar results to the SMA.

In the Wikipedia interpretation?

 
Alexander_K2:

As interpreted from Wikipedia?

It's no different from the others.))

 
Alexander_K2:

So, just take the WMA, exponential weights and get the EMA? According to the formulas, it's not the same thing.

Yes, we do. But weights will decrease to infinity. You get a WMA with exponentially decreasing weights.

Suppose there is a series of prices p1, p2, p3, p4, p5, ...pN
and there is a coefficient k - the weight ema

ema1 = p1*k

ema2 = p2*k + ema1*(k-1)
if we get rid of the past ema values, only vector p and k remains
ema2 = p2*k + (p1*k)*(k-1)

ema3 = p3*k + ema2*(k-1)
if we get rid of the past ema values
ema3 = p3*k + (p2*k + (p1*k)*(k-1))*(k-1)
ema3 = p3*k + (p2*k)*(k-1) + (p1*k)*(k-1)^2

ema4 = p4*k + ema3*(k-1)
if we get rid of
ema4 = p4*k + (p3*k + (p2*k)*(k-1) + (p1*k)*(k-1)^2)*(k-1)
ema4 = p4*k + (p3*k)*(k-1) + (p2*k) * (k-1)^2 + (p1*k) * (k-1)^3

etc.
e.g. when calculating ema on the basis of thousand of past prices, the weight for the oldest price will be k * (k-1)^999

That is why, in order not to bother with endless calculations, ema(N) can be calculated by the formula directly from EMA(N-1)
But in this case the first calculated ema will not be accurate enough.

 
Dr. Trader:

Yes, we will. But the weights will decrease to infinity. You get a WMA with exponentially decreasing weights.

Suppose there is a price series p1, p2, p3, p4, p5, ...pN
And there is a coefficient k - the weight ema

ema1 = p1*k

ema2 = p2*k + ema1*(k-1)
if we get rid of the past ema values, only vector p and k remains
ema2 = p2*k + (p1*k)*(k-1)

ema3 = p3*k + ema2*(k-1)
if we get rid of the past ema values
ema3 = p3*k + (p2*k + (p1*k)*(k-1))*(k-1)
ema3 = p3*k + (p2*k)*(k-1) + (p1*k)*(k-1)^2

ema4 = p4*k + ema3*(k-1)
if we get rid of
ema4 = p4*k + (p3*k + (p2*k)*(k-1) + (p1*k)*(k-1)^2)*(k-1)
ema4 = p4*k + (p3*k)*(k-1) + (p2*k) * (k-1)^2 + (p1*k) * (k-1)^3

etc.
e.g. when calculating ema on the basis of thousand of past prices, the weight for the oldest price will be k * (k-1)^999

That is why, in order not to bother with endless calculations, ema(N) can be calculated using the formula directly from EMA(N-1)
But in this case the first calculated ema will not be accurate enough.

Doc, I think you're a genius. А?

 
Probably :)
 

In the meantime, I'm bending the quote stream over my knee.

Here's what it looks like now (on the right-hand chart) for a sliding window = 8 hours and a readout interval = 2 seconds.

GBPJPY pair