logo
Welcome Guest! To enable all features please Login or Registers.

Notification

Icon
Error

Options
Go to last post Go to first unread
jhughey  
#1 Posted : Friday, December 19, 2008 1:02:50 PM(UTC)
jhughey

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/19/2008(UTC)
Posts: 19
Location: New York State

Was thanked: 2 time(s) in 1 post(s)
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:6.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}


Hello!


Thanks for making it available!


Before I located the .dll, I had been trying to code this beast myself for a couple of days. Now, after all the work I put into this, I would still like to understand why my own MS coding of MAMA did not work.This is just purely academic interest; and, being new at MS coding, I would just enjoy getting some closure seeing my own code working.

So far I have stepped through each statement of the code from start to finish, and I have evaluated each term, ratio, arctangent, phase, period to see that the numerical results are all within reasonable bounds and do not blow up.

The only clue I have is that Ehler's Easy Language initialization of all variables to zero is not commensurate with the Metastock code.However, this certainly does not resemble the MS Forum's dll version, and FAMA never diverges from MAMA.

Here is my code.

Thanks for your help!

Joe

---------------------------------------------------------------

Price1 := Typical();

FastLimit := 0.5;

SlowLimit := 0.05;

Smooth := 0;

Detrender := 0;

In1 := 0;

Qd1 := 0;

In2 := 0;

Qd2 := 0;

jIn := 0;

jQd :=0;


Re := 0;

Im := 0;

Period := 0;

SmoothPeriod :=0;

Phase := 0;

DeltaPhase := 0;

alpha :=0;

MAMA := 0;

FAMA := 0;

Smooth := (4*Price1 + 3*Ref(Price1,-1) + 2*Ref(Price1,-2)+ Ref(Price1,-3))/10;


Detrender :=

Qd1 := ( 0.0962*Detrender + 0.5769*Ref(Detrender,-2) - 0.5769*Ref(Detrender,-4) - 0.0962*Ref(Detrender,-6) ) * (0.075*Ref(Period,-1) + 0.54);


In1 := Ref(Detrender,-3);



jIn := ( 0.0962*In1 + 0.5769*Ref(In1,-2) - 0.5769*Ref(In1,-4) - 0.0962*Ref(In1,-6) ) * (0.075*Ref(Period,-1) + 0.54);

jQd := ( 0.0962*Qd1 + 0.5769*Ref(Qd1,-2) - 0.5769*Ref(Qd1,-4) - 0.0962*Ref(Qd1,-6) ) * (0.075*Ref(Period,-1) + 0.54);


In2 := In1 -

Qd2 := Qd1 +

In2 := 0.2 * In2 + 0.8 * Ref(In2, -1);

Qd2 := 0.2 * Qd2 + 0.8 * Ref(Qd2, -1);

Re := In2*Ref(In2,-1) + Qd2*Ref(Qd2,-1);

Im := In2*Ref(Qd2,-1) - Qd2*Ref(In2,-1);

Re := 0.2*Re + 0.8*Ref(Re,-1);

Im := 0.2*Im + 0.8*Ref(Im,-1);

Period If( (Im*Re <> 0), 360/(Atan(Im,Re)), Period);

Period If( Period

Period If( Period < Period);

Period

Period If( Period > 50, 50, Period);

Period := 0.2*Period + 0.8*Ref(Period,-1);


{ Not clear why SmoothPeriod was included in Ehler's code, since the calculation does not use it. }

SmoothPeriod := 0.33*Period + 0.67*Ref(Smoothperiod,-1);

Phase := If(In1<>0, Atan(Qd1,In1),Phase);


DeltaPhase := Ref(Phase,-1) - Phase;

DeltaPhase := If(DeltaPhase <1, 1, DeltaPhase);



alpha := FastLimit/Deltaphase;

alpha := If(alpha<SlowLimit,SlowLimit,alpha);



MAMA := alpha*Price1 + (1-alpha)*Ref(MAMA,-1);


FAMA := 0.5*alpha*MAMA + (1-(0.5*alpha))*Ref(FAMA,-1);

MAMA;

FAMA;


Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Back to top
wabbit  
#2 Posted : Wednesday, February 4, 2009 11:03:11 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
The creation of Ehlers work requires internal loops, not achievable in MSFL requiring external functions to be used. See : http://forum.equis.com/forums/thread/27974.aspx
Users browsing this topic
Guest (Hidden)
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.