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
|
|
|
|
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.