Discussions
»
Product and Service Development
»
Formula Assistance
»
Instantaneous TrendLine (Cybernetics) by Dr. Ehlers
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/24/2005(UTC) Posts: 77 Location: Canada
|
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:1:e5eb0f8b35]
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;
[/code:1:e5eb0f8b35]
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
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Instantaneous TrendLine (Cybernetics) by Dr. Ehlers
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.