converting to mql4

 

hi im trying to convert indicator from pine script to mql4 

length = input(14),morph = input(0.9,minval=0,maxval=1),mult = input(1.),flatten = input(1.)
//----
x = n
y = close
m(a,b) =>
    p = morph * a + (1-morph) * b
k = nz(m(k[length],y),y) + (x-x[length])/(x[length*2]-x[length]) * (nz(m(k[length*2],y),y) - nz(m(k[length],y),y))/flatten
k1 = sma(k,length)
er = cum(abs(y-k1))/n * mult
//----
a = k1 + er
b = k1 - er

i attempted to calculate k[i] //k for starter 

 for(int i=Bars-(lenght*2); i>=0; i--)
     {
      x[i]=n;
      y=Close[i];
      if(x[i-(lenght*2)]!=0)
        {
      k[i]=m(k[i-lenght],y)+(x[i]-x[i-lenght])/(x[i-(lenght*2)]-x[lenght])*m(k[i-(lenght*2)],y)-m(k[i-lenght],y)/flatten;       
        }
     }

 but here is the thing i dont see where x is assigned any values? can you please guide me to where is the x array value assignment, im reading the pine documentation to figure this but no luck so far thanks