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

Notification

Icon
Error

Options
Go to last post Go to first unread
rjr27  
#1 Posted : Wednesday, March 21, 2012 7:30:45 AM(UTC)
rjr27

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/21/2012(UTC)
Posts: 2

Hello all, I'm fairly new to Metastock and this forum. I would like to create a formula that would find the highest high of a given period that increased by Y% in X number of days from highest high, where the highest high is not the last day. Thanks for the help
wabbit  
#2 Posted : Wednesday, March 21, 2012 9:15:10 AM(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)
Huh?

Start by breaking the project into small chunks:

1) Find "the highest high of a given period"
Code:
prd:=10; {bars}
HH:=HHV(H,prd);


2)Find "increased by Y% in X number of days"
Code:
X:=10; {bars}
Y:=25; {percent}
testForChange:=ROC(HH,X,%)>Y;


I don't understand the rest of the requirements, maybe because it's nearly midnight here... but I hope you have something to at least start your project with. Get into the MS User Manual and the free Equis Formula Primer to learn more about coding and then have a crack at writing the rest of the functionality on your own; if you get stuck post your code here.



wabbit [:D]


rjr27  
#3 Posted : Wednesday, March 21, 2012 10:43:45 AM(UTC)
rjr27

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/21/2012(UTC)
Posts: 2

Thank you Wabbit for your reply. I probably didn't made my self clear judging by your "huh?". here is the scenario I'm trying to solve: 10 days ago, securities that reached a new high (high of the last 60 days) after rising by at least 25% (Y) in 5 days (X). The current securities values is below the highest high reached 10 days ago. Unfortunately, the ROC function is in relation to the last period doesn't compute from the HHV. I do i create a custom function that calculates the rate of change that 5 days leading to the HHV? Thanks
wabbit  
#4 Posted : Wednesday, March 21, 2012 6:34:46 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)
Where is your code attempt?

Give a man a fish and he eats for a day. Teach a man to fish and he eats everyday.


wabbit [:D]

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.