MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Correlation Coefficient

Has anyone written any MS or AB code to solve for cointegration?
If not, does anyone have the forumula in English so that I could try to code it to be shared by all?
I'm trying to improve on my "pairs" trading systems that are currently just using correlation coefficients.

fmlvar I never got it got much out of it. Good concept though.
If you get it right fix and repost Donald

Correlation Coefficient

pds:=.3;
l1:={FmlVar("xvss","Vv")}C;
y1:= {(Trough(1,L1,pds))}l1;
y2:= (Trough(1,L1,pds));
y3:= (Trough(2,L1,pds));

x1:= {(TroughBars(1,L1,pds))}1;
x2:= (TroughBars(1,L1,pds));
x3:= (TroughBars(2,L1,pds));

ex:=x1+x2+x3;
ey:=y1+y2+y3;
exy:=(x1*y1)+(x2*y2)+(x3*y3);
xsqrt:=(x1*x1)+(x2*x2)+(x3*x3);
ysqrt:=(y1*y1)+(y2*y2)+(y3*y3);
Vv:=((3*exy)-(ex*ey))/(Sqrt((3*xsqrt)-(ex*ex))*
Sqrt((3*ysqrt)-(ey*ey)))*-1;
Vv;

Kera

Keara...

Do you have any idea where your code came from? I'm working my way through it, but not quite sure how to apply it. I have it working, but not sure how much information the result contains. About where you left it, I guess.
Anything more you can tell me?

Chuck : Correlation Coefficient. Precalculus book is where I found the formula and typed it in myself. Look up Correlation Coefficient.

Good luck.

Source / From: TOP
Eequismetastock[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.