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

Notification

Icon
Error

Options
Go to last post Go to first unread
StorkBite  
#1 Posted : Saturday, July 16, 2005 7:23:53 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
What is the preferred way to show a horizontal line on a chart- to enter it as part of the formula or just to draw it out? The only advantage I can see to drawing it out is that it can be extended to the right side.
bearishbull  
#2 Posted : Saturday, July 16, 2005 9:32:39 PM(UTC)
bearishbull

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/30/2005(UTC)
Posts: 71

depends, if you are to lazy to be in front of your screen all the time it's nice to set a sound alert on a horizontal line. This is not possible if you draw it.. got another question..any idea for a code to draw a diagonal line?
henry1224  
#3 Posted : Saturday, July 16, 2005 11:19:56 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Are we talking about Trendlines?
StorkBite  
#4 Posted : Saturday, July 16, 2005 11:23:49 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
StorkBite  
#5 Posted : Saturday, July 16, 2005 11:26:19 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Quote:
set a sound alert on a horizontal line. This is not possible if you draw it
Thanks BB- The little things make all the difference doesn't they? That's neat. :D
Jose  
#6 Posted : Sunday, July 17, 2005 7:59:43 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Here's another example of ploting a straight line between two points: MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste formula below. [code:1:ee0cb64904] ============ 2-point plot ============ ---8<--------------------------- { 2-point plot, coding example v2.5 } { Trendline choice 1: last High/Low in month } { Trendline choice 2: lows at Jan/June 2004 } { (c) Copyright 2003-2004 Jose Silva } { http://www.metastocktools.com } plot:=Input("choose event trend [1~2]",1,2,1); choose:=Input("plot: trendline [1], event points [2]",1,2,1); {define events} time1:=C=HHV(C,21); time2:=C=LLV(C,21); time2:=time2 AND time2<>time1; {alternative events} dateA:=Year()=2004 AND Month()=1; dateA:=If(LastValue(Cum(dateA))=0, Year()=LastValue(Year())-1 AND Month()=LastValue(Month()),dateA); LoValA:=Lowest(ValueWhen(1,dateA,L)); timeA:=dateA AND L=LastValue(LoValA); dateB:=Year()=2004 AND Month()=6; dateB:=If(LastValue(Cum(dateB))=0, Year()=LastValue(Year()) AND Month()=LastValue(Month()),dateB); LoValB:=Lowest(ValueWhen(1,dateB,L)); timeB:=dateB AND L=LastValue(LoValB); timeB:=timeB AND timeB<>timeA; {choose events} time1:=If(plot=1,time1,timeA); time2:=If(plot=1,time2,timeB); price1:=If(plot=1,C,L); price2:=If(plot=1,C,L); {restrict to last events} time1:=time1 AND Cum(time1)=LastValue(Cum(time1)); time2:=time2 AND Cum(time2)=LastValue(Cum(time2)); {sort events} t1pds:=LastValue(BarsSince(time1)); t2pds:=LastValue(BarsSince(time2)); x1:=If(t1pds>=t2pds,time1,time2); x2:=If(t1pds>=t2pds,time2,time1); y1:=If(t1pds>=t2pds,price1,price2); y2:=If(t1pds>=t2pds,price2,price1); {fix coordinates} y1:=ValueWhen(1,x1,y1); y2:=LastValue(ValueWhen(1,x2,y2)); b1:=LastValue(BarsSince(x1)); b2:=LastValue(BarsSince(x2)); {trendline definition} plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2+.000001); plot:=Ref(Ref(plot,-b2),b2);{rem to extend plot} If(choose=1,plot,time1+time2) ---8<--------------------------- [/code:1:ee0cb64904] jose '-) http://www.metastocktools.com
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.