With reference to the calculation of the cycle length has the following Easy
language code been ported to AFL?
If so can someone plase guide me to it?
Bet Regards
Rakesh
==========
*EL Code for calculating current cycle length using Hilbert period*
==========
Inputs: Price(numeric);
Vars: Smoother(0),Detrender(0),I1(0),Q1(0),jI(0),
jQ(0),I2(0),Q2(0),X1(0),X2(0),Y1(0),Y2(0),Re(0),Im(0),Period(0);
If CurrentBar>5 then begin
Smoother=(4*Price+3*Price[1]+2*Price[2]+Price[3])/10;
Detrender=(.25*Smoother+.75*Smoother[2]-.75*Smoother[4]-.25*Smoother[6])*(.046*Period[1]+.332);
{Compute InPhase and Quadrature components}
Q1=(.25*Detrender+.75*Detrender[2]-.75*Detrender[4]-.25*Detrender[6])*(.046*Period[1]+.332);
I1=Detrender[3];
{advance the phase of I1 and Q1 by 90 degrees}
jI=.25*I1+.75*I1[2]-.75*I1[4]-.25*I1[6];
jQ=.25*Q1+.75*Q1[2]-.75*Q1[4]-.25*Q1[6];
{Phasor addition to equalize amplitude due to quadrature calculations (and 3
bar average)}
I2=I1-jQ;
Q2=Q1+jI;
{Smooth the I and Q components before applying the discriminator}
I2=.15*I2+.85*I2[1];
Q2=.15*Q2+.85*Q2[1];
{Homodyne Discriminator}
{Complex Conjugate Multiply}
X1=I2*I2[1];
X2=I2*Q2[1];
Y1=Q2*Q2[1];
Y2=Q2*I2[1];
Re=X1+Y1;
Im=X2-Y2;
{Smooth to remove undesired cross products}
Re=.2*Re+.8*Re[1];
Im=.2*Im+.8*Im[1];
{Compute Cycle Period}
If Im<>0 and Re<>0 then Period = 360/ArcTangent(Im/Re);
If Period>1.5*Period[1] then Period = 1.5*Period[1];
If Period<.67*Period[1] then Period=.67*Period[1];
If Period<.6 then Period = 6;
If Period>50 then Period=50;
Period=.2*Period+.8*Period[1];
{End Core Code}
HilbertPeriod=Period;
end;
==========
On Tue, Jun 16, 2009 at 6:30 AM, Herman <[email protected]> wrote:
>
>
> Functions using the AmiBroker BB or StDev() work fine. My original works
> fine to.
>
>
> herman
>
>
>
> Monday, June 15, 2009, 4:39:28 PM, you wrote:
>
>
> > Herman,
>
>
> > Are you seeing the same problem with each of the other approaches
> (including your original)?
>
>
> > Mike
>
>
> > --- In [email protected], "bruce1r" <bru...@...> wrote:
>
>
> >> Herman - I only check the board sporadically and don't see attachments.
> But I've duplicated what I think you are seeing on real-time data that I
> have, and need a little while before I can look at it. At first blush, it
> looks to be related to single precision and small changes at small time
> intervals. We'll either find a workaround, or I'll post something that I
> had planned to in a while anyway that addresses the general case problem of
> implementing variable periods for any function.
>
>
> >> -- BruceR
>
>
>
>
>
>
> > ------------------------------------
>
>
> > **** IMPORTANT PLEASE READ ****
>
> > This group is for the discussion between users only.
>
> > This is *NOT* technical support channel.
>
>
> > TO GET TECHNICAL SUPPORT send an e-mail directly to
>
> > SUPPORT {at} amibroker.com
>
>
> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>
> > http://www.amibroker.com/feedback/ <http://www.amibroker.com/feedback/>
>
> > (submissions sent via other channels won't be considered)
>
>
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>
> > http://www.amibroker.com/devlog/ <http://www.amibroker.com/devlog/>
>
>
> > Yahoo! Groups Links
>
>
> > http://groups.yahoo.com/group/amibroker/
>
>
> > Individual Email | Traditional
>
>
> > http://groups.yahoo.com/group/amibroker/join
>
> > (Yahoo! ID required)
>
>
> >
> > mailto:[email protected]<[email protected]>
>
>
> >
> > mailto:[email protected]<[email protected]>
>
>
> > [email protected]
>
>
> > http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
>