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

Notification

Icon
Error

Options
Go to last post Go to first unread
Jose  
#1 Posted : Saturday, November 26, 2005 4:18:51 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)
This MS indicator plots the Rate of Change (RoC) for each year, resetting to zero (% or $) at the beginning of each year. It may be useful for comparing markedly different charts, using the default % change option. If there is a demand for it, I'll consider coding a monthly version of the same. [code:1:f5e4d1ca7e] MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formula between "---8<---" lines. ========== Yearly RoC ========== ---8<----------------------------- { Yearly Rate of Change (RoC) v2.0 ©Copyright 2004~2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } method:=Input("Method: [1]%percent, [2]$points",1,2,1); yr:=Input("RoC for Year [1800~2200]", 1800,2200,2005); yrNr:=Input("Year's RoC: [1]Selected, [2]All", 1,2,2); plot:=Input("plot: [1]RoC, [2]New Year signals",1,2,1); { Start of year } init:=Cum(1)=2; nuYear:=Year()<>Ref(Year(),-1) OR init; { Data Array } x:=C; { Year's % RoC change } chPer:=(x/ValueWhen(1,nuYear,x)-1)*100; { Year's $ RoC change } chPts:=x-ValueWhen(1,nuYear,x); { Select %/$ RoC method } ch:=If(method=1,chPer,chPts); { Restrict RoC to selected year } chYear:=If(Year()=yr,ch,0); chYear:=ValueWhen(1,chYear<>0 OR init,chYear); { Select individual year's RoC or all years } chPer:=If(yrNr=1,chYear,ch); { Plot in own window } If(plot=1,chPer,nuYear) ---8<----------------------------- [/code:1:f5e4d1ca7e] jose '-)
Jose  
#2 Posted : Sunday, November 27, 2005 8:47:29 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)
Related to the above, this indicator plots the (selected or all) year's High & Lows: [code:1:8641189ed3] MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formula between "---8<---" lines. ============ Year's Hi/Lo ============ ---8<----------------------------- { Yearly High & Low v2.0 ©Copyright 2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } yr:=Input("Year [1800~2200]",1800,2200,2004); yrNr:=Input("Year: [1]Selected, [2]All", 1,2,2); plot:=Input("[1]Year's Hi/Lo, [2]NewYear signals",1,2,1); { Start of year } init:=Cum(1)=2; nuYear:=Year()<>Ref(Year(),-1) OR init; { Highest/Lowest of year } YearHi:=HighestSince(1,nuYear,H); YearLo:=LowestSince(1,nuYear,L); { Restrict High to selected year } xYrHi:=If(Year()=yr,YearHi,0); xYrHi:=If(Year()>=yr,xYrHi,C); xYrHi:=ValueWhen(1,xYrHi>0,xYrHi); { Restrict Low to selected year } xYrLo:=If(Year()=yr,YearLo,0); xYrLo:=If(Year()>=yr,xYrLo,C); xYrLo:=ValueWhen(1,xYrLo>0,xYrLo); { Select: individual year's Hi/Lo or all years } pYrHi:=If(yrNr=1,xYrHi,YearHi); pYrLo:=If(yrNr=1,xYrLo,YearLo); { Plot on price chart } If(plot=1,pYrHi,0); If(plot=1,pYrLo,nuYear) ---8<----------------------------- [/code:1:8641189ed3] jose '-)
johnl  
#3 Posted : Monday, November 28, 2005 3:26:08 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

May be a good way to select stocks to look at in a first run of an explorer. will have to play around with it. I have used this years H,L,C compared with last years H,L as a first run of an explorer to select stocks I want to look at, with this code I should be able to combine into one indicator like you have done. Thanks.
konrad  
#4 Posted : Monday, November 28, 2005 11:42:10 PM(UTC)
konrad

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/6/2005(UTC)
Posts: 424
Location: connecticut,USA

Hey Joes Do you have indicator that show Quoter(qtr) Rate of Change (RoC) or Half year (ROC) I want to get indicator to see how stock change from last quoter to present day or last half year to present day Best Regard konrad
Jose  
#5 Posted : Tuesday, November 29, 2005 5:59:01 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)
Konrad, coding/testing indicators take up valuable time - my fee for specific custom work is the same as Equis' @ US$60/hr. However, if I find a strong demand for this function, I'll then consider coding it here. jose '-)
Jose  
#6 Posted : Friday, December 23, 2005 7:12:54 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)
This indicator code update deals with the difficult issue of finding the correct closing price of the year. [code:1:4e4caca50c] MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formula between "---8<---" lines. ========== Yearly RoC ========== ---8<----------------------------- { Yearly Rate of Change (RoC) v3.0 ©Copyright 2004~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } method:=Input("Method: [1]%percent, [2]$points",1,2,1); yr:=Input("RoC for Year [1800~2200]", 1800,2200,2004); yrNr:=Input("Year's RoC: [1]Selected, [2]All", 1,2,2); plot:=Input("plot: [1]RoC, [2]Year signals", 1,2,1); { Start/End of year } nuYear:=Year()<>Ref(Year(),-1) OR Cum(1)=2; YearEnd:=PeakBars(1, -(nuYear OR Cum(IsDefined(nuYear))=1),1)=0; init:=Cum(IsDefined(YearEnd))=1; { Data Array } x:=C; { Year's $ RoC change } chPts:=x-ValueWhen(1,YearEnd,x); chPts:=If(YearEnd=0,chPts, Ref(chPts,-1)+x-Ref(x,-1)); { Year's % RoC change } chPer:=(x/ValueWhen(1,YearEnd,x)-1)*100; chPer:=If(YearEnd=0,chPer, Ref(chPer,-1)+(x/Ref(x,-1)-1)*100); { Select %/$ RoC method } ch:=If(method=1,chPer,chPts); { Restrict RoC to selected year } chYear:=If(Year()=yr,ch,0); chYear:=If(Year()=yr,chYear, ValueWhen(1, init OR YearEnd AND Year()=yr,chYear)); { Select individual year's RoC or all years } chPer:=If(yrNr=1,chYear,ch); { Plot in own window } If(plot=1,chPer,nuYear-YearEnd) ---8<----------------------------- [/code:1:4e4caca50c] jose '-)
Jose  
#7 Posted : Friday, December 23, 2005 10:49:38 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)
This updated indicator now includes historical as well as yearly RoC plots. [code:1:2e152c4d21] ========== Yearly RoC ========== ---8<----------------------------- { Yearly Rate of Change (RoC) v4.0 ©Copyright 2004~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } method:=Input("Method: [1]%percent, [2]$points",1,2,1); yr:=Input("RoC for Year [1800~2200]", 1800,2200,2004); yrNr:=Input("Yearly RoC: [1]Year, [2]Yearly, [3]Historical",1,3,2); plot:=Input("plot: [1]RoC, [2]Year signals", 1,2,1); { Start/End of year } nuYear:=Year()<>Ref(Year(),-1) OR Cum(1)=2; YearEnd:=PeakBars(1, -(nuYear OR Cum(IsDefined(nuYear))=1),1)=0; init:=Cum(IsDefined(YearEnd))=1; { Data Array } x:=C; { Yearly $ RoC change } chPts:=x-ValueWhen(1,YearEnd,x); chPts:=If(YearEnd=0,chPts, Ref(chPts,-1)+x-Ref(x,-1)); { Yearly % RoC change } chPer:=(x/ValueWhen(1,YearEnd,x)-1)*100; chPer:=If(YearEnd=0,chPer, Ref(chPer,-1)+(x/Ref(x,-1)-1)*100); { Select %/$ RoC method } ch:=If(method=1,chPer,chPts); { Restrict RoC to selected year } chYear:=If(Year()=yr,ch,0); chYear:=If(Year()=yr,chYear, ValueWhen(1, init OR YearEnd AND Year()=yr,chYear)); { Historical RoC from beginning of chart } chAllPts:=x-ValueWhen(1,Cum(1)=1,x); chAllPer:=(x/ValueWhen(1,Cum(1)=1,x)-1)*100; { Select %/$ historical RoC method } chAll:=If(method=1,chAllPer,chAllPts); { Select type of Yearly RoC } YearRoc:=If(yrNr=1,chYear,If(yrNr=2,ch,chAll)); { Plot in own window } If(plot=1,YearRoc,nuYear-YearEnd) ---8<----------------------------- [/code:1:2e152c4d21] jose '-)
Jose  
#8 Posted : Sunday, December 25, 2005 7:36:06 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)
This version now also plots RoC on the first incomplete year of data. [code:1:ade8958479] ========== Yearly RoC ========== ---8<----------------------------- { Yearly Rate of Change (RoC) v4.1 Note: First incomplete year plots RoC from 4th bar. ©Copyright 2004~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } method:=Input("Method: [1]%percent, [2]$points",1,2,1); yr:=Input("RoC for Year [1800~2200]", 1800,2200,2004); yrNr:=Input("Yearly RoC: [1]Year, [2]Yearly, [3]Historical",1,3,2); plot:=Input("plot: [1]RoC, [2]Year signals", 1,2,1); { Start/End of year } nuYear:=Year()<>Ref(Year(),-1) OR Cum(1)=2; YearEnd:=PeakBars(1,-(nuYear OR Cum(IsDefined(nuYear))=1 OR Cum(1)=4),1)=0; init:=Cum(IsDefined(YearEnd))=1; { Data Array } x:=C; { Yearly $ RoC change } chPts:=x-ValueWhen(1,YearEnd,x); chPts:=If(YearEnd=0,chPts, Ref(chPts,-1)+x-Ref(x,-1)); { Yearly % RoC change } chPer:=(x/ValueWhen(1,YearEnd,x)-1)*100; chPer:=If(YearEnd=0,chPer, Ref(chPer,-1)+(x/Ref(x,-1)-1)*100); { Select %/$ RoC method } ch:=If(method=1,chPer,chPts); { Restrict RoC to selected year } chYear:=If(Year()=yr,ch,0); chYear:=If(Year()=yr,chYear, ValueWhen(1, init OR YearEnd AND Year()=yr,chYear)); { Historical RoC from beginning of chart } chAllPts:=x-ValueWhen(1,Cum(1)=1,x); chAllPer:=(x/ValueWhen(1,Cum(1)=1,x)-1)*100; { Select %/$ historical RoC method } chAll:=If(method=1,chAllPer,chAllPts); { Select type of Yearly RoC } YearRoc:=If(yrNr=1,chYear,If(yrNr=2,ch,chAll)); { Plot in own window } If(plot=1,YearRoc,nuYear-YearEnd) ---8<----------------------------- [/code:1:ade8958479] jose '-)
Jose  
#9 Posted : Saturday, December 31, 2005 1:54:11 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)
How well did your market perform in 2005? [code:1:49682b88cd] RoC % for year 2005 ------------------- Indices ------- +40.2% Nikkei 225 +27.1% DAX +23.4% CAC 40 +17.6% ASX 200 +16.7% FTSE 100 +7.0% NYSE Composite +4.5% Hang Seng +3.0% S&P 500 +1.4% Nasdaq Composite -0.5% Dow Jones Commodities ----------- +40.5% Crude Oil +15.1% Wheat (Kansas) +13.8% Gold Currencies/USD$ --------------- +3.5% Canadian $ -6.0% Australian $ -10.1% British Pound -12.5% Euro -12.7% Japanese Yen [/code:1:49682b88cd] jose '-)
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.