You can't run an exponential moving average in the same way as a simple moving average.
An EMA requires at least 3.45×(Length+1) bars for 99.9% convergence. So for an EMA(30) you require at least 107 bars.
You will actually need much more to get the exact same value as the build in indicator.
Please read the following post ... https://www.mql5.com/en/forum/446533/page2#comment_46578197
You can't run an exponential moving average in the same way as a simple moving average.
An EMA requires at least 3.45×(Length+1) bars for 99.9% convergence. So for an EMA(30) you require at least 107 bars.
You will actually need much more to get the exact same value as the build in indicator.
Please read the following post ... https://www.mql5.com/en/forum/446533/page2#comment_46578197
In above code 30 is just fixed buffer size.
MA period is 10
It is still not enough. You would need at least 38 bars for 99.9% convergence and even then it will not give the same value.
An EMA is an infinitely weighted moving average. It does not work like an SMA. Read the math explained in the Wikipedia link.
It is still not enough. You would need at least 38 bars for 99.9% convergence and even then it will not give the same value.
An EMA is an infinitely weighted moving average. It does not work like an SMA. Read the math explained in the Wikipedia link.
You don't hear me.
Its not a problem to increase buffer ...
but even if I do it I got totally different result
For eg original indicator shows 35 ... I got -12 and so on and so on
Then please apply the same maths correctly ...
MetaQuotes, 2010.01.26 11:09
Chaikin's volatility indicator calculates the spread between the maximum and minimum prices. It judges the value of volatility basing on the amplitude between the maximum and the minimum. Unlike Average True Range, Chaikin's indicator doesn't take gaps into account.Calculation:
H-L (i) = HIGH (i) - LOW (i)
H-L (i - 10) = HIGH (i - 10) - LOW (i - 10)
CHV = (EMA (H-L (i), 10) - EMA (H-L (i - 10), 10)) / EMA (H-L (i - 10), 10) * 100where:
- HIGH (i) - maximum price of current bar;
- LOW (i) - minimum price of current bar;
- HIGH (i - 10) - maximum price of the bar ten positions away from the current one;
- LOW (i - 10) - minimum price of the bar ten positions away from the current one;
- H-L (i) - difference between the maximum and the minimum price in the current bar;
- H-L (i - 10) - difference between the maximum and the minimum price ten bars ago;
- EMA - exponential moving average.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Unable to calculate Chaikin Volatility in Expert only for current bar
The resulting value is totally different from built-in MT5 indicator.