rma functions from pinescript to MT5

 

I want to port the functions from pinescript to MT5 but I don't know how to do the recursive part.

rma(src, length,m) =>

    alpha = m / length

    sum = 0.0

    sum := na(sum[1]) ? sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])

This part of 'sum[1]' is not known how to implement