when arrays are set as series, the previous value would be:
ema_avrng[i+1]
and not:
ema_avrng[i-1]
so I think should be
ExponentialMA(i, period, (i == 0 ? 0 : ema_avrng[i+1]), avrng))
You could use ExponentialMA function from MovingAverages.mqh instead as well

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
The pinescript formula:
My MQL5 Code: