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

Notification

Icon
Error

Options
Go to last post Go to first unread
Bullion  
#1 Posted : Monday, July 10, 2006 2:56:49 PM(UTC)
Bullion

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 6

The question I have is the following: I follow a porfolio of stocks. The security data I use for each one of them, are local data (they are stored in the Downloader) I want to know two very simple things: 1- How much has a stock performed since day 1 of trading. 2- How much has a stock performed YTD (Year To Date). I don´t find the answer directly in Metastock. What do I have to do? Thanks.
Jose  
#2 Posted : Tuesday, July 11, 2006 1:26:42 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)
Your answer is here: Yearly Rate of Change (RoC) v3.0 indicator. jose '-)
Bullion  
#3 Posted : Wednesday, July 26, 2006 2:34:21 PM(UTC)
Bullion

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 6

Hi José: Your answer is an indicator and I want to use a formula and then performe an exploration. I was thinking to use this formula: roc(close,(number of days between today and 31/12/2005),%). NHowever I don´t know how to calculate number of days between today and 31/12/2005. could you help? thank you once again
wabbit  
#4 Posted : Wednesday, July 26, 2006 3:45:53 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Bullion, Is performance measured as the difference of the price today versus the price on 01 January? In which case, you don't need to count the number of days.... --8<----------------------------- dd:=Input("Day",1,31,1); mm:=Input("Month",1,12,1); yy:=Input("Year",1901,2099,2006); x:=Input("[1]Open [2]High [3]Low [4]Close",1,4,4); x:=(x=1)*O + (x=2)*H + (x=3)*L + (x=4)*C; start:=Year()>yy OR (Year()=yy AND (Month()>mm OR Month()=mm AND DayOfMonth()>=dd)); pr:=ValueWhen(1,start AND Alert(start=0,2),x); ch:=100*(x-pr)/pr; ch; --8<----------------------------- Very similar code was also recently posted at http://forum.equis.com/viewtopic.php?t=4351 The code will show you how much the price has changed (in percent) from the price on the given date. Please read up in the MS Users Manual how to use MetaStock Formula Language code in explorations. It is an easy task to copy this code (or Jose's) into one of the exploration columns and set a filter criteria. Hope this helps. wabbit :D
Bullion  
#5 Posted : Wednesday, July 26, 2006 4:29:22 PM(UTC)
Bullion

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 6

Hi Wabbit; Thanks for your help. I'm going to read the manual and learn. However, does my formula works' Is it possible to have a function to count those days? Thanks, from Portugal
wabbit  
#6 Posted : Wednesday, July 26, 2006 4:54:28 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Yes.... --8<----------------------------- dd:=Input("Day",1,31,1); mm:=Input("Month",1,12,1); yy:=Input("Year",1901,2099,2006); start:=Year()>yy OR (Year()=yy AND (Month()>mm OR Month()=mm AND DayOfMonth()>=dd)); count:=BarsSince(start and Alert(start=0,2)); count; --8<----------------------------- Untested code, but it should get you close. Note this is counting BARS not calendar days. If you want calendar days, then Jose has some tools to sort this out for you. To use this code in the way that I think you are planning on using it will generate an error, you will have to make the last two lines: count:=LastValue(BarsSince(start and Alert(start=0,2))); count; wabbit :D
Bullion  
#7 Posted : Wednesday, July 26, 2006 6:19:45 PM(UTC)
Bullion

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 6

hi wabbit, I've tried to paste the formula you posted, but I've got a error message saying: - this function (Input) is not allowed. thanks again
StorkBite  
#8 Posted : Wednesday, July 26, 2006 6:49:23 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)
Make sure that you don't paste the start and stop tags. Omit these lines: --8<-----------------------------
wabbit  
#9 Posted : Wednesday, July 26, 2006 11:19:32 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
G, Bullion was trying to paste the code into an exploration, which cannot use the Input() function. You have to replace the Input() functions with just the variables and their values: e.g. dd:=1; mm:=1; yy:=2006; etc wabbit :D P.S. It was very late when I posted last night.... after a VERY long day. Sorry for any inconvenience.
StorkBite  
#10 Posted : Thursday, July 27, 2006 7:54:58 AM(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)
Bullion wrote:
Your answer is an indicator and I want to use a formula and then performe an exploration.
Oops... it wasn't late when I posted, I just didn't read closely enough.
Bullion  
#11 Posted : Friday, July 28, 2006 3:49:33 PM(UTC)
Bullion

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 6

OK! I'm going to replace the values. I'll report if I have any more dificulties. Thanks again.
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.