double aEMA[]; ⋮ aEMA[i] = aEMA[i-1] + alpha*(price-aEMA[i-1]);
- You are using an array; on each new bar, you will have to resize it and recompute all bars. Make it a buffer.
- Val is a buffer; which defaults to as-series. Yet your computation is non-series.
- close[] has no predefined direction (as-series or non-series). Always set it per the documentation.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
In my learning of MQL4, I try to rewrite the exponential moving average (EMA).
For this I'm using the rewritten version . EMA(i) = EMA(i-1) + alpha * [Price(i) - EMA(i-1)]
The problem is my ema is very different of MT4 ema.
Someone can tell me what is going wrong with my code please