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

Notification

Icon
Error

Options
Go to last post Go to first unread
JBlogs  
#1 Posted : Saturday, January 21, 2012 11:17:28 AM(UTC)
JBlogs

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 1/21/2012(UTC)
Posts: 1

I am new to Metastock formulas, but I would like to know how I could change the way the Relative Strength Comparative formula works. Currently it will take eg: IBM trading at $180 and divide that by the DJIA at 12,720 there I get a return of 0.01415. I would like to take the rate of change of IBM against the rate of change for the DJIA and accumulate the values, with the DJIA set as the base as in the current RSC formula does.
wabbit  
#2 Posted : Saturday, January 21, 2012 5:57:33 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)
Use the Security() function to get the data then compute the ROC(), or call the ROC() directly in the Security() function call. (There is a speed difference, but I cannot remember which is the fastest method, do your own testing.)

e.g.
Code:


x:=Security("{path}IBM", C);


y:=Security("{path}DJIA", C);



x:=ROC(x,1,%);
y:=ROC(y,1,%);


{plot}

x/y



Code:

x:=Security("{path}IBM", ROC(C,1,%));
y:=Security("{path}DJIA", ROC(C,1,%));

{plot}
x/y



NOTE: There is no error handling here -- watch out for divide by zero errors!



wabbit [:D]

P.S. There is also a data synchronisation issue to be dealt with, which is not covered in the code above.

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.