PureBytes Links
Trading Reference Links
|
Hi Corey
Thanks for your response. After studying your afl
implementation for a few moments it suddenly occurred to me what the
problem was with my approach. Now I can move on through his
book.
Mike
At 01:42 AM 5/1/2004, you wrote:
Try:
//Ehlers ITrend (Cybernetic Analysis for
Stocks and Futures p.24)
SetBarsRequired(1000000,1000000);
Y=(H+L)/2; //Price
alpha=Param("alpha",0.07,0.01,1,0.01);
Smooth=0;ITrend=0;Trigger=0;
for(i=2;i<BarCount;i++)
{
ITrend[i]=(alpha-alpha*alpha/4)*Y[i]+0.5*alpha*alpha*Y[i-1]-(alpha-0.75*alpha*alpha)*Y[i-2]+2*(1-alpha)*ITrend[i-1]-(1-alpha)*(1-alpha)*ITrend[i-2];
if(i<7) ITrend[i]=(Y[i]+2*Y[i-1]+Y[i-2])/4;
Trigger[i]=2*Itrend[i]-ITrend[i-2];
}
Clr=IIf(Trigger>Y,colorGreen,IIf(Trigger<Y,colorRed,colorYellow));
Plot(ITrend, "ITrend",1,8);
Plot(Trigger, "Trigger",Clr,8);
Plot(Y,"Prices",2,8);
GraphXSpace=5;
Title=" \\c03Ehlers ITrend (Cyber) \\c01ITrend \\c00Trigger
\\c-1alpha "+alpha+" ";
-CS
----- Original Message -----
From: bmwmcrider
To: amibroker@xxxxxxxxxxxxxxx
Sent: Friday, April 30, 2004 6:00 AM
Subject: [amibroker] X-lation of Ehler's EasyLanguage code int afl
Hello,
I just started reading Ehler's Cybernetic Analysis For Stocks And
Futures. On page 24 he presents an indicator, ITrend, in
EasyLanguage script as follows:
Inputs: Price((H+L)/2),
Alpha(.07);
Vars: Smooth(0),
ITrend(0),
Trigger(0);
ITrend = (alpha - alpha*alpha/4)*Price
+ .5*alpha*alpha*Price[1] - (alpha
- .75*alpha*alpha)*Price[2] + 2
*(1 - alpha)*ITrend[1] - (1 - alpha)
*(1- alpha)*ITrend[2];
If currentbar < 7 then ITrend = (Price + 2*Price[1]
+ Price[2])/4;
Trigger = 2*ITrend - ITrend[2];
Plot1(ITrend, "ITrend");
Plot2(Trigger, "Trig");
I am not knowledgeable on EasyLanguage script. Anxious to see his
code in operation I attempted a literal translation of the above
into afl script as follows:
price = (H+L)/2;
alpha = .07;
iTrend = 0;
iTrend = IIf(BarIndex()<7,(price + 2*Ref(price,-1) +
Ref(price,-2))/4, ((alpha - alpha*alpha/4) *
price + .5*alpha*alpha*Ref(price,-1) -
(alpha - .75*alpha*alpha)*Ref(price,-2) +
2*(1 -alpha)*Ref(iTrend,-1) -
(1 - alpha)*(1 - alpha)*Ref(iTrend,-2)));
trigger = 2*iTrend - Ref(iTrend,-2);
Plot(iTrend,"iTrend",colorGreen,styleLine);
Plot(trigger,"Trigger", colorRed,styleLine);
Upon placing the above in IB and plotting the results I got a set of
bizarre looking traces. I expected a set of traces similar to, say,
moving averages.
If anyone out there knowledgeable on EasyLanguage could look at my
implementation of Ehler's script and point out any errors that I
might have made I would be grateful.
Mike
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
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
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
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
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|