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

Notification

Icon
Error

Options
Go to last post Go to first unread
RUTrading  
#1 Posted : Thursday, May 2, 2013 9:24:04 PM(UTC)
RUTrading

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 6/12/2012(UTC)
Posts: 19
Location: South Africa - JHB

Hi,

I am trying to create the relative performance formula using the S&P 500 and compare it to many of my stocks.

Now, I know how to plot it on a chart by just taking the relative performance indicator and plotting it on the chart. Which I did and added a 52 Simple Moving Average on top of it.

Now when I go to use explorer, I can't seem to be able to create the relative performance formula and scan all my stocks to find when the 52 week moving average of the relative performance formula is trending up?

Here is my attempt after finding a formula on this forums and changing it a little:

Code:
x:= Security("C:\MetaStock Data\BM Data\.SPX",C); y:= 1; z:= 52; R:= C/x; base:= Sum(R,z)/z;mf:= ((Ref(R,-y)/base)-1)*10; Mov(mf,z,S)>Ref(Mov(mf,z,S),-3)
I am not sure where I have got it wrong as I am still learning the formula language. All I know is it does not match up and I think I have the relative performance formula is wrong as it looks different to the one used from the chart indicator and not sure if using a moving average is the best for determining if it is trending up, but it is the easiest I think?

Can someone please help me with my frustration??
John S  
#2 Posted : Friday, May 3, 2013 11:15:15 AM(UTC)
John S

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/9/2012(UTC)
Posts: 169

I took a crack at this. This should be close. Others on this forum could probably simplify/improve this I'm sure. Cut and paste this into column A of your exploration and see if it gives you what you want.

Code:
 SPX:= Security("C:\MetaStock Data\BM Data\.SPX",C); 

SPXBarCount:=If(Cum(1)=1,SPX,0);
Day1Close:=ValueWhen(1,SPXBarcount<>0,SPX);
SPXPerformance:=((SPX-Day1Close)/Day1Close)*100;

PlotBarCount:=If(Cum(1)=1,C,0);
Day1Close:=ValueWhen(1,PlotBarcount<>0,C);
PlotPerformance:=((C-Day1Close)/Day1Close)*100;

RPI:=PlotPerformance-SPXPerformance;

MA:=Mov(RPI,52,S);

MA>Ref(MA,-3)
RUTrading  
#3 Posted : Sunday, May 5, 2013 6:08:42 AM(UTC)
RUTrading

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 6/12/2012(UTC)
Posts: 19
Location: South Africa - JHB

Thanks John for your time and effort, works great. Tested it over the weekend. Appreciate the help.
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.