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

Notification

Icon
Error

Options
Go to last post Go to first unread
pepsi1834@hotmail.com  
#1 Posted : Sunday, May 24, 2015 12:45:10 PM(UTC)
pepsi1834@hotmail.com

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 5/23/2015(UTC)
Posts: 2

I have a very simple question.   Say I have 100 stocks, would like to know their closing price as at 31 Dec 2014, how should I write this function in MetaStock?

 

I am aware of the REF() function, but I don't think its a good approach as I need to count the number of trading day, and also, the number of trading for different stock may be different.

 

Thanks

mstt  
#2 Posted : Sunday, May 24, 2015 9:22:27 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi pepsi Here is a simple piece of code that could be used in one column of an exploration of your 100 securities. Note that you need to load a specific number of bars (say 150 or more) rather than use the Load Minimum Bars setting. The Y variable signals the first bar of each new year, and the output line picks up the CLOSE price of the previous bar. Y:=Year(); ValueWhen(1,Y<>Ref(Y,-1),Ref(C,-1)); Roy
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.