[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Hilbert transform homodyne discriminator cycle measurement



PureBytes Links

Trading Reference Links

 forgot to add, the code below is in MS language.
 peter.
--- In amibroker@xxxxxxxxxxxxxxx, "amiabilityy" <amiabilityy@xxxx> 
wrote:
> I found this code while searching  another site for the kaufman 
code.
> 
>  anyone willing to convert it to AFL.
> 
> This code is nearly the same as the one that computes the Hilbert 
> transform homodyne discriminator cycle measurement, with the 
> additional code to compute phase rate of change, the nonlinear 
alpha, 
> and the MAMA and FAMA lines. 
> 
> FastLimit:=(0.5);
> SlowLimit:=(0.05);
> Smooth:=(4*MP()+3*Ref(MP(),-1)+2*Ref(MP(),-2)+Ref(MP(),-3))/10;
> Detrender:=(0.0962*Smooth+0.5769*Ref(Smooth,-2)- 0.5769*Ref(Smooth,-
> 4)-0.0962*Ref(Smooth,-6))*(0.075*PREV+0.54);
> 
> Q1:=(0.0962*Detrender+0.5769*Ref(Detrender,-2)-0.5769*Ref
(Detrender,-
> 4)-0.0962*Ref(Detrender,-6))*(0.075*PREV+0.54);
> l1:=Ref(Detrender,-3);
> jl:=(0.0962*l1+0.5769*Ref(l1,-2)-0.5769*Ref(l1,-4)-0.0962*Ref(l1,-
6))*
> (0.075*PREV+0.54);
> jQ:=(0.0962*Q1+0.5769*Ref(Q1,-2)-0.5769*Ref(Q1,-4)-0.0962*Ref(Q1,-
6))*
> (0.075*PREV+0.54);
> l2:=l1+jQ;
> Q2:=Q1+jl;
> l2:=0.2*l2+0.8*Ref(l2,-1);
> Q2:=0.2*Q2+0.8*Ref(Q2,-1);
> Re:=l2*Ref(l2,-1)+Q2*Ref(Q2,-1);
> lm:=l2*Ref(Q2,-1)+Q2*Ref(l2,-1);
> Re:=0.2*Re+0.8*Ref(Re,-1);
> lm:=0.2*lm+0.8*Ref(lm,-1);
> 
> Phase:=If(l1<>0,Atan(Q1,l1),0);
> DeltaPhase:=Ref(Phase,-1)-Phase;
> DeltaPhase:=If(DeltaPhase<1,1,0);
> alpha:=FastLimit/DeltaPhase;
> alpha:=If(alpha<SlowLimit,SlowLimit,alpha);
> alpha:=If(alpha>FastLimit,FastLimit,alpha);
> 
> MAMA:=alpha*MP()+(1-alpha)*PREV;
> FAMA:=0.5*alpha*MAMA+(1-0.5*alpha)*PREV;
> MAMA;
> FAMA
> 
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > You may also see #12863
> > CS was kind enough to make this [as many others] offer.
> > DT
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "amiabilityy" 
<amiabilityy@xxxx> 
> > wrote:
> > >   Heres a metastock code if someone would like to convert it.
> > > 
> > >  
> > > 
> > > Periods := Input("Time Periods",1,1000,2);
> > > Direction := P - Ref(P,-periods);
> > > Volatility := Sum(Abs(ROC(P,1,$)),periods);
> > > Volatility:=If(Volatility>0,Volatility,0.00001);
> > > ER := Abs(Direction/Volatility);
> > > FastSC := 2/(2 + 1);
> > > SlowSC := 2/(30 + 1);
> > > SSC := ER * (FastSC - SlowSC) + SlowSC;
> > > Constant := Pwr(SSC,2);
> > > AMA := If(Cum(1) = periods +1, Ref(P,-1) + constant * (P - Ref
(P,-
> > > 1)),PREV + constant * (P - PREV));
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "traderix2003" <d.adam@xxxx> 
> > wrote:
> > > > Hi,
> > > > has someone the formula for the KAMA (Kaufman´s adaptive 
moving 
> > > > average)?


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/