Here is the code :
FONCTION T3.AVERAGE.SERIES
Inputs: Price(NumericSeries), Periods(NumericSimple);
Variables: b(0), b2(0), b3(0), e1(Price), e2(Price), e3(Price),
e4(Price), e5(Price), e6(Price), c1(0), c2(0), c3(0),
c4(0), f1(0), f2(0), Hot(0.7);
if Periods + 1 <> 0 then begin
if CurrentBar <= 1 then begin
b = Hot;
b2 = b * b;
b3 = b * b * b;
c1 = -b3;
c2 = 3 * b2 + 3 * b3;
c3 = -6 * b2 - 3 * b - 3 * b3;
c4 = 1 + 3 * b + b3 + 3 * b2;
f1 = 2 / (Periods + 1);
f2 = 1 - f1;
end else begin
e1 = f1 * Price + f2 * e1[1];
e2 = f1 * e1 + f2 * e2[1];
e3 = f1 * e2 + f2 * e3[1];
e4 = f1 * e3 + f2 * e4[1];
e5 = f1 * e4 + f2 * e5[1];
e6 = f1 * e5 + f2 * e6[1];
end;
T3Average.series = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
end;
the thing is I want to use this "function" in another ninjascript but as you can see "price" is a parameter.
I don't know how to proceed.
Can anyone help ?
Comment