Tomasz,

 

Chuck’s explanation, and your formula and code below look like a good candidate for the KB.

 

Regards,

 

Dan.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Tomasz Janeczko
Sent: Thursday, March 09, 2006 4:23 AM
To: [email protected]
Subject: Re: [amibroker] What is Correlation

 

Hello,

 

Built-in correlation is calculated according to this formula:

 

\rho_{X,Y}=\frac{E(XY)-E(X)E(Y)}{\sqrt{E(X^2)-E^2(X)}~\sqrt{E(Y^2)-E^2(Y)}} 

 

 

 

It can be re-coded in AFL as:

 

 

function Correl( x, y, number )
{
 nom= MA( x * y, number ) - MA( x, number ) * MA( y, number );
 denom = sqrt( MA( x ^ 2, number ) - MA( x, number ) ^ 2 ) *
 sqrt( MA( y ^ 2, number ) - MA( y, number ) ^ 2 );
 return nom/denom;
}

Graph0=Correlation( C, Ref( H, -2 ), 10 ); // built-in

Graph1=Correl( C, Ref( H, -2 ), 10 ); // re-coded;


Best regards,
Tomasz Janeczko
amibroker.com

----- Original Message -----

From: "Graham" <[EMAIL PROTECTED]>

To: "amibroker" <[email protected]>

Sent: Thursday, March 09, 2006 8:29 AM

Subject: [amibroker] What is Correlation

 

> Can anyone tell me what Correlation is actually calculating
> I have read the description in help files but am still confused what
> it is actually calculated.
> In what way is it actually comparing the 2 arrays.
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
>
http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Try Online Currency Trading with GFT. Free 50K Demo. Trade
> 24 Hours. Commission-Free.
>
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
> --------------------------------------------------------------------~->
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
>
http://www.amibroker.com/support.html
>

> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
>   
http://groups.yahoo.com/group/amibroker/
>
> <*> To unsubscribe from this group, send an email to:
>   
[EMAIL PROTECTED]
>
> <*> Your use of Yahoo! Groups is subject to:
>   
http://docs.yahoo.com/info/terms/

>
>
>



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS




Reply via email to