[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Correlation Matrix - code help .... GOT IT!



PureBytes Links

Trading Reference Links

Hi,
    While you are testing in exel there is a helpful parameter callled "Kurtosis" in exel which measures the peakness of fund relative to normal distribution.Another parameter is the Skew.YOu  know how skewed your distribution is along with the correlation. 
    I am interested in the correlation study.I havent attempted any yet so far (busy with  other things ) but was going to attempt soon.I would be tuned to this topic and very interested in your findings and please do post your findings here.I had given a cursory glance to these parameters before something else came up.
     Hope these parameters help improve your study .
 
----N !!
 
   

Jason Hart <jhart_1972@xxxxxxxxx> wrote:
Paul,
 
Thanks for the suggestions, I appreciate it.  Well, it's a little closer but it is not an exact match to the Excel results.  However, the energy ETFs, namely OIH and XLE, have very modest correlations to the price of crude oil - only about 0.54.  In some of the other results it was high as 0.85-0.90 which is where I would expect it to be.
 
Where I'm struggling is with the time periods.  in this line I have a 125 day lookback period :

Test =

Correlation( Var1, Var2,

125 );

If I run the explore for n=1 day it will not return any results.  I was under the impression that I control the lookback with the dates, so I ran a lookback of 6 months from 9/1/04 to 3/4/05.  When I control the time period in this manner I do get results, but the problem is the results are dated 1/21/2005.  I'm confused as to how the time periods work ~ why is it generating results from 1/21/2005 and why do I need to run explore with a wide dispersion in the dates instead of running it n=1.
Jason 

"Paul A." <amibroker@xxxxxxxxxxxxx> wrote:
You've got a type mismatch.  Foreign doesn't accept float numbers to be passed as the 2nd argument.  You've made a formula that you've put quotes around, mistakenly notifying Foreign() to NOT evaluate it as a mathematical formula but rather to accept it as a string of characters, i.e., as a written word.  Foreign's second argument does indeed require a string, but only certain strings referring to datafields, like: "open, low, close, O, L, C" etc.  Read the online docs here:

http://www.amibroker.com/guide/afl/afl_view.php?id=54

What's confusing for you is that AB didn't balk (though it should have!) at accepting such nonsense in the 2nd argument, and instead allowed it but treated it for some reason as "C".  That's why you got the same result from both ways.

Try this instead, off the top of my head.  Let me know if it works.

Var1 = ROC(Foreign(Ticker1, "C"), 1);

Regarding your second question: Correlation() doesn't (or at least shouldn't!) automatically convert prices to ROCs without being told to do so explicitly by you.  Rather, it should examine a correlation between two arrays of your choice, without trying to second guess what's in the arrays.

    -Paul

At 05:46 PM 3/5/2005, you wrote:

Var1 =

Foreign
(Ticker1, "C");

To this:

Var1 =

Foreign
(Ticker1, "ROC(C,1)");

I'm not a great programmer so I have two questions:  1.  is this the correct way of manipulating the foreign argument and  2.  is the original formula already correctly measuring the correlations by using ROC vs. closing price?


Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





Warm regards,
Natasha !
 
Visit The Doll Palace [Where Cartoon Dolls Live]


Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links