[Help] What is the Real Formula of Exponential Moving Average? Please explain it to me. I searched in internet, I found many EMA Formula.

 

[Help] What is the Real Formula of Exponential Moving Average? Please explain it to me.

I searched in internet, I found many EMA Formula. I want to know the right way to calculate EMA. I need the real formula of EMA.

 

Either: newEma = (newVal-prvEma)*c + prvEma

or     : newEma = c*newVal + ( 1-c )*prvEma

With c = 2/(n+1) to be the closest to a n-period sma.

Both are the same if you do just some math.

 
Musngi: I searched in internet, I found many EMA Formula. I want to know the right way to calculate EMA. I need the real formula of EMA.
Carl Schreiber:

Either: newEma = (newVal-prvEma)*c + prvEma

or     : newEma = c*newVal + ( 1-c )*prvEma

With c = 2/(n+1) to be the closest to a n-period sma.

Both are the same if you do just some math.

  1. There is only one. Moving average - Wikipedia
  2. Carl Schreiber gave you two forms of the same equation. The first does not magnify round off errors. Don't use the second form.
 
Musngi: [Help] What is the Real Formula of Exponential Moving Average? Please explain it to me.

I searched in internet, I found many EMA Formula. I want to know the right way to calculate EMA. I need the real formula of EMA.

If you want to learn the maths and how it is all connected and what equations are better suited to prevent rounding errors and such, have a look at this paper which includes the Exponential Moving Average:

 
Fernando Carreiro:

If you want to learn the maths and how it is all connected and what equations are better suited to prevent rounding errors and such, have a look at this paper which includes the Exponential Moving Average:

Thank you for this link!

Have you seen there is at the end a very simple method to calc the variance of data compared to their mean - a lot simpler than the normal bollinger bands.

Have you ever created a modified BB based on that formula? Have you compared it to the original ones?

 
Carl Schreiber: Have you seen there is at the end a very simple method to calc the variance of data compared to their mean - a lot simpler than the normal bollinger bands.

Have you ever created a modified BB based on that formula? Have you compared it to the original ones?

EDIT: Please note that the method at the very end is for calculating variance of an EMA, but the classical Bollinger Bands uses SMA, so it does not directly apply!

Yes, the equation gives almost identical results in comparison to the calculations by the MQL functions, but the formula is more accurate and has less rounding errors (and much faster)!

Yes, I do have an Indicator that uses that formula for Bollinger Bands on an Adaptive EMA with the Efficiency Ratio calculated based on the Exponential ATR. I plan to release that indicator on the MQL5 Market for both MetaTrader 4 and 5 sometime in January.

 

Oh - interesting! Please overlay your 'BB' and the original BB for a better and easy understanding.

Thanks in advance!

 
Carl Schreiber: Oh - interesting! Please overlay your 'BB' and the original BB for a better and easy understanding.

Can't do that as the original Bollinger is based on SMA and not EMA, plus my indicator is an Adaptive EMA and does not have a fixed constant period.

 
Can't you load both as indicators  on the same chart in different coloures with almost the same period-length?
 
Carl Schreiber:
Can't you load both as indicators  on the same chart in different coloures with almost the same period-length?

As I stated the Period is Adaptive (changes from bar to bar) plus it is an EMA and BB is based on SMA (they are different).

EDIT: Here is a comparative screenshot (First one is the BB and the second my TRAEMA - True Range based Adaptive Exponential Moving Average)


 
Fernando Carreiro:

If you want to learn the maths and how it is all connected and what equations are better suited to prevent rounding errors and such, have a look at this paper which includes the Exponential Moving Average:

I don't see EMA in that pdf