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

Notification

Icon
Error

Options
Go to last post Go to first unread
WindsurfStew  
#1 Posted : Saturday, March 28, 2009 12:27:25 PM(UTC)
WindsurfStew

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/28/2006(UTC)
Posts: 8

Consider this. I have two indicators on my chart. I select both then drag the Correlation function onto a new inner window. In order to verify this I write a custom function (below) and compare the two. Both have a lookback of 200 and no shift. The curves are way out. Why is this?

Curve 1 - select both securities and drag-n-drop Correlation function.

Curve 2 - custom as below

SEC1:=Security("C:\MetaStock\Forex\AUDUSD", C);
SEC2:=Security("C:\MetaStock\Australia\ASX 200\^AXJO", C);
COR:=Correl(SEC2, SEC1, 200, 0);
COR

Stewart

wabbit  
#2 Posted : Monday, April 6, 2009 8:43:52 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)
Stewart,

I did a couple of quick tests and found sometimes the charts were the same and sometimes they were different!?

One solution might be to manually code up the correlation indicator yourself and see which version is right.



wabbit [:D]
wabbit  
#3 Posted : Monday, April 6, 2009 9:19:58 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)
OK... curiosity got the better of me.


---------------------------------

x:=Security("C:\MetaStock\Forex\AUDUSD", C);
y:=Security("C:\MetaStock\Australia\ASX 200\^AXJO", C);

n:=200;

num:=Sum(x*y,n)-n*Mov(x,n,S)*Mov(y,n,S);
den:=n*Stdev(x,n)*Stdev(y,n);

num/Max(den,Power(10,-8));
---------------------------------



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.