PureBytes Links
Trading Reference Links
|
Corey Saxe had your solution--I've pasted it below.
Regards,
Bob
----
/* Instantaneous Trendline
TASC V. 18:5 (18-27): Adaptive Trends and Oscillators by Ehlers
AFL conversion by Corey Saxe */
//SetBarsRequired(10000,10000);
Y=(H+L)/2;
pi = 4 * atan(1) ; //Pi
RTD = 180/pi;//radians to degrees
DTR = pi/180;//degrees to radians
//InPhase & Quad Components-----
V1=Y-Ref(Y,-6);
V2=Ref(V1,-3);
V3 =0.75*(V1 - Ref(V1,-6)) + 0.25*(Ref(V1,-2)- Ref(V1,-4));
IP = AMA(V2,0.33);
Quad = AMA(V3,0.2);
//Use ArcTan to compute the current phase---
Phase=IIf (abs(IP + Ref(IP,-1)) > 0,
atan(abs( (Quad+Ref(Quad,-1)) / ( IP + Ref(IP,-1) ))) * RTD, 0);
Phase=IIf (IP < 0 AND Quad > 0, 180 - Phase,
IIf (IP < 0 AND Quad < 0, 180 + Phase,
IIf (IP > 0 AND Quad < 0, 360 - Phase, Phase)));
//Compute differential phase-------
DP = Ref(Phase,-1) - Phase;//DeltaPhase
DP = IIf ( Ref(Phase,-1) < 90 AND Phase > 270, 360 + Ref(Phase,-1) -
Phase, DP);
DP = IIf (DP < 1 , 1, IIf (DP > 60, 60, DP));
//Sum deltaphases, sum is Instantaneous Period--
instper=0; V4=0;
for(i=40;i<BarCount;i++)
{
for(j=0;j<40;j++)
{
V4[i]=V4[i] + DP[i-j];
if(V4[i]>360 AND InstPer[i]==0) InstPer[i]=j;
}
}
//Resolve Instantaneous Period errors & smooth---
instper=IIf(instper==0,40,instper);
V5=AMA(InstPer,0.25);
period=int(V5);
Adj=Param("MS Adj",2,0,3,1);
TL=Sum(Y,period+Adj)/(period+Adj);//Trendline
V11=AMA(Y+0.5*(Y-Ref(Y,-3)),0.33);
Plot(V11, "Sig",3,1);
Plot(TL, "Trendline",0,1);
Plot(C,"Prices",2,128);
//Plot(V11-TL,"Diff",IIf((V11-TL)<0,4,5),1|styleOwnScale);
dir1 =TL>Ref(TL,-1);
dir2 =V11>TL;
Plot( 2.5,"TL>Ref(TL,-1)",IIf( dir1, colorGreen,
colorRed ),styleOwnScale|styleArea|styleNoLabel, 0, 100);
Plot(3,"black",colorBlack,styleOwnScale|styleArea|styleNoLabel,0,
100 );//black line
Plot( 5.5,"TL>Sig",IIf( dir2, colorGreen,
colorRed ),styleOwnScale|styleArea|styleNoLabel, 0, 100);
GraphXSpace=5;
Title=" Ehlers Instantaneous Trendline ";
-----Original Message-----
From: Christoper [mailto:turkey@xxxxxxxxxxxxxxx]
Sent: Wednesday, November 17, 2004 7:16 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Plotting Zero Axis Trend Bar
How do you plot a thick horizontal line at the bottom of a graph?
For example, I have a trend system, and I would like to plot the OHLC,
with a colored bar on teh bottom (green and red). I don't have an
issue with the colors, but just getting a thick bar at the bottom. I
can plot a really thin line, but that's too thin.
- chris
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
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:
http://docs.yahoo.com/info/terms/
|