Calculation of EMA
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.
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