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

Notification

Icon
Error

Options
Go to last post Go to first unread
garykong  
#1 Posted : Thursday, January 5, 2006 9:02:17 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Dear all, I would like to draw two lines - the high and low for the first 5 trading days' (a variable, i.e. it can be changed when plugging in) high and low for the rest of month on a daily chart. For example in Jan 2006, the first 5 trading days are 3 Jan, 4 Jan, 5 Jan, 6 Jan and 9 Jan. Draw two lines based on the high and low of these 5 trading days for Jan in a daily chart. How can I do that?? Gary
Jose  
#2 Posted : Thursday, January 5, 2006 10:32:47 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)
Being only the 4th/5th of January so far, you will need to wait until the 6th & 9th of January to find the highest/lowest of the first 5 days in Jan. Until then, try this chart indicator: [code:1:39954c8600] pds:=Input("Lookback periods",1,2600,5); limit:= ValueWhen(1,Cum(1)=LastValue(Cum(1))-pds+1,1); Hi:=LastValue(HHV(H,pds))*limit; Lo:=LastValue(LLV(L,pds))*limit; Hi;Lo; [/code:1:39954c8600] jose '-)
garykong  
#3 Posted : Thursday, January 5, 2006 1:10:09 PM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Jose wrote:
Being only the 4th/5th of January so far, you will need to wait until the 6th & 9th of January to find the highest/lowest of the first 5 days in Jan. Until then, try this chart indicator: [code:1:6888597503] pds:=Input("Lookback periods",1,2600,5); limit:= ValueWhen(1,Cum(1)=LastValue(Cum(1))-pds+1,1); Hi:=LastValue(HHV(H,pds))*limit; Lo:=LastValue(LLV(L,pds))*limit; Hi;Lo; [/code:1:6888597503] jose '-)
Hi Jose, I will try this .. Does this code work for the other 11 months? I want it to show the respective 5-day high / low in each month.... Gar
Jose  
#4 Posted : Thursday, January 5, 2006 1:45:39 PM(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)
The code above only plots the high/low of the last 5 bars. Try this indicator instead: [code:1:403928e108] ========================= Month's variable High/Low ========================= ---8<-------------------------- {©Copyright 2006 Jose Silva. For personal use only. http://www.metastocktools.com } { User input } pds:=Input("Use High/Low of first x periods in month",1,31,5); { New month signal } NuMonth:=Month()<>Ref(Month(),-1) OR Cum(1)=2; { Restrict High/Low to first x periods } period:=BarsSince(NuMonth)<=pds; { High/Low } hi:=ValueWhen(1,period,HighestSince(1,NuMonth,H)); lo:=ValueWhen(1,period,LowestSince(1,NuMonth,L)); { Plot on price chart } hi; { Blue } lo; { Red } ---8<-------------------------- [/code:1:403928e108] Keep in mind these two points: 1) MetaStock can only draw continuous (uninterrupted) plots; 2) New highs/lows can only be plotted as they happen, and not in retrospect. jose '-)
garykong  
#5 Posted : Friday, January 6, 2006 6:44:07 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Thanks Jose, It seems working on the daily chart... Will that work on the intraday chart with the same concept? Gary
Jose  
#6 Posted : Friday, January 6, 2006 8:19:21 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)
Gary, the "Month's variable High/Low" indicator will work on any chart from monthly to intraday periodicity. If by "same concept" you mean "first 5 bars in intraday chart, then replace: { New month signal } NuMonth:=Month()<>Ref(Month(),-1) OR Cum(1)=2; for: { New day signal } NuMonth:=DayOfMonth()<>Ref(DayOfMonth(),-1) OR Cum(1)=2; jose '-)
garykong  
#7 Posted : Friday, January 6, 2006 9:49:20 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Hi Jose, Sorry that I have not made it clear. Same concept means first 5-day for the month also for the intraday chart... How can I amend the code? Thanks! Gary
Jose wrote:
Gary, the "Month's variable High/Low" indicator will work on any chart from monthly to intraday periodicity. If by "same concept" you mean "first 5 bars in intraday chart, then replace: { New month signal } NuMonth:=Month()<>Ref(Month(),-1) OR Cum(1)=2; for: { New day signal } NuMonth:=DayOfMonth()<>Ref(DayOfMonth(),-1) OR Cum(1)=2; jose '-)[/quote
Jose  
#8 Posted : Friday, January 6, 2006 1:43:46 PM(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)
That's all I can offer for now, Gary. If no one else can help, then it's time to recruit some professional help. ;) jose '-)
garykong  
#9 Posted : Friday, January 6, 2006 1:50:44 PM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Well, thanks Jose! thanks for your help in developing the code..... =D> Would there be anyone who can help me finishing the other part of the code... appreciate for your help! :D Gary
Jose wrote:
That's all I offer for now, Gary. If no one else can help, then it's time recruit some professional help. ;) jose '-)[/quote
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.