PureBytes Links
Trading Reference Links
|
Arr1=C;
Arr2=Yrs;
Lookback=30;
Covar=correlation (Arr1, Arr2,Lookback)*StDev(Arr1)*StDev(Arr2);
Var=StDev(Arr1)^2;
A few points:
1) Lookback is arbitrary. Longer is better.
2) You're dealing with non-stationary series. Be careful about
interpretation of statistics.
3) Since correlation of a series with itself is 1, Var is simply
StDev-squared.
4) AB's StDev is based on assumed full population, whereas you're
only using a sample. I.e. purists need to adjust for this.
Hopefully, once the account-manager is fully functional, TJ will
think about adding matrix-functions, with which we could easily
create var-covar matrices of portfolio-returns, factor-returtns, etc.
(Yes, I know I can already do this in AFL, but what about an inverted
matrix??)
PS
--- In amibroker@xxxxxxxxxxxxxxx, "aleskresta" <ales.kresta@xxx>
wrote:
>
> Greetings,
>
> I am still a little bit confused about arrays in AB, could
someone
> give me an example of one simple thing:
>
> 1)I have an array of Close prices
> 2)I want to create an array(the same length as first) of a number
> 1,2,3, nad so on
> 3)I want to compute covarience between array 1 and array 2, and
> variance of array 2
>
> Because I am confused about arrays I don't know how to do the
second
> thing
>
> Thanks a lot for advice
>
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/694 - Release Date: 2/20/2007 1:44 PM
|