Finally I got a solution for my own older post inquiry: "How To Code Recursive Functions in MS".
Below is Dr. Ehlers ITrend indicator, as described in his excellent work "Cybernetic Analysis for Stocks and Futures".
I have added my own initialization periods linear algorithm that will eliminate the large converging time required by the original formula for low Alpha values.
----------------------
Code:
Pc:=Input("Price Code: C/Med/Typ/WC=1-4",1,4,3);
Len:=Input("ITrend Periods",3,1000,5);
ILen:=Input("ITrend Initialization Periods",
10,1000,60);
Pr:=
If(Pc=1,C,
If(Pc=2,MP(),
If(Pc=3,Typ(),WC())));
Alpha:=2/(Len+1);
Ap:=If(Cum(1)<ILen,0.33-Cum(1)*(0.33-Alpha)/ILen, Alpha);
A1:=Ap-0.25*Ap*Ap;
A2:=0.5*Ap*Ap;
A3:=Ap-0.75*Ap*Ap;
B1:=2*(1-Ap);
B2:=(1-Ap)*(1-Ap);
IT:=A1*Pr+A2*Ref(Pr,-1)-A3*Ref(Pr,-2)+B1*PREV-B2*Ref(PREV,-1);
IT;
-------------------------
The plot is ALMOST identical with the "ADSI.ITrend" plot, but I can say the differences are insignificant!
The differences are generated by the less accurate computations in MetaStock vs. the DLL version of ADSI.
Also the 2 PREV function should significantly slow down the computations, not to mention the simulations.
Hope some will find it helpful.
Guara