Coding a pinescript formula on mql5
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
The pinescript formula:
My MQL5 Code: