How to convert Well Wilders MA to v4?

157 views Asked by At
wwma(l,p) =>

wwma = (nz(wwma[1]) * (l - 1) + p) / l

I'm going to convert it to v4, but I got a error, Undeclared identifier 'wwma'. Then changed to:

wwma = 0.

wwma := (nz(wwma[1]) * (l - 1) + p) / l

Still an error:

Undeclared identifier 'l';
Undeclared identifier 'p';
'wwma' is not a function.

Any help would be appreciated.

1

There are 1 answers

0
e2e4 On BEST ANSWER

Create a function f_wwma with l and p arguments as shown below:

f_wwma(l, p) =>
    wwma = 0.
    wwma := (nz(wwma[1]) * (l - 1) + p) / l

Then you can call that function with defined length (l) and source (p) arguments:

wwma = f_wwma(50, close)

plot(wwma)