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

To add comments, please log in or register
307

[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.

7292

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.

15917

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.
2883

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:

7292

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?

2883

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.

7292

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

Thanks in advance!

2883

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.

7292

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

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)

307

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
To add comments, please log in or register