StockFetcher Forums · General Discussion · Correlation value confusion...<< >>Post Follow-up
lis
37 posts
msg #146351
Ignore lis
1/31/2019 1:53:58 PM

I'm trying to look at correlation values. I seem to be showing positive and negative counts correctly, using my filter below; however, the 'between' counts are always the same in any given result. For example, GE shows 10, and AMD shows 3 for all of them. What silly thing am I missing?

Fetcher[
chart-time is 200 days
chart-type is candlestick

set{corrposspx,count(corr(^SPX,2,close) greater than 0.9,200)}
set{corrnegspx,count(corr(^SPX,2,close) less than -0.9,200)}
set{corrnospx,count(corr(^SPX,2,close) between 0.1 and -0.1,200)}
set{corr50spx,count(corr(^SPX,2,close) between 0.5 and -0.5,200)}

set{corrposiuxx,count(corr(^IUXX,2,close) greater than 0.9,200)}
set{corrnegiuxx,count(corr(^IUXX,2,close) less than -0.9,200)}
set{corrnoiuxx,count(corr(^IUXX,2,close) between 0.1 and -0.1,200)}
set{corr50iuxx,count(corr(^IUXX,2,close) between 0.5 and -0.5,200)}

add column separator
add column corrposspx {spx pos corr}
add column corrnegspx {spx neg corr}
add column corrnospx {spx no corr}
add column corr50spx {spx 50pct corr}

add column separator
add column corrposiuxx {iuxx pos corr}
add column corrnegiuxx {iuxx neg corr}
add column corrnoiuxx {iuxx no corr}
add column corr50iuxx {iuxx 50pct corr}

draw corr(^SPX,2,close)
draw corr(^SPX,2,close) line at 1.0
draw corr(^SPX,2,close) line at -1.0
draw corr(^IUXX,2,close)
draw corr(^IUXX,2,close) line at 1.0
draw corr(^IUXX,2,close) line at -1.0
]



four
5,087 posts
msg #146358
Ignore four
1/31/2019 3:15:08 PM

1st guess... try creating a separate SET for the BETWEEN

lis
37 posts
msg #146360
Ignore lis
1/31/2019 4:04:02 PM

I'm not sure what you mean, four...

And, FWIW, I did also try:

set{corr0spx,count(corr(^SPX,2,close) equal 0,200)}

but it gave me the same number as the BETWEEN versions.


four
5,087 posts
msg #146361
Ignore four
1/31/2019 8:28:08 PM

Does this offer any help/work for your question?
----

set{a,count(corr(^SPX,2,close) greater than 0.9,200)}
add column a

set{b,count(corr(^SPX,2,close) between 0.1 and -0.1,200)}
add column b




lis
37 posts
msg #146372
Ignore lis
2/1/2019 2:08:10 PM

I guess a better way to say it is that all three of the following statements end up showing the same resulting values for a stock:

set{corrnospx,count(corr(^SPX,2,close) between 0.1 and -0.1,200)}
set{corr50spx,count(corr(^SPX,2,close) between 0.5 and -0.5,200)}
set{corr0spx,count(corr(^SPX,2,close) equal 0,200)}}

I didn't expect all three statements to show the same count, so I thought I must be doing something wrong.

For example, in today's (Feb 1, 2019) results for GE, all three columns show 10. For AAPL, they all show 1, and for AAU, they all show 29. I would've expected, say, a lower number for the count between 0.1 and -0.1, as its results would've been included in the 0.5 to -0.5 count. And, maybe, by chance, a stock or two would've had the same counts for all of them - but *every* stock???

Fetcher[
symlist(ge,aapl,aau)
chart-time is 200 days
chart-type is candlestick

set{corrnospx,count(corr(^SPX,2,close) between 0.1 and -0.1,200)}
set{corr50spx,count(corr(^SPX,2,close) between 0.5 and -0.5,200)}
set{corr0spx,count(corr(^SPX,2,close) equal 0,200)}

add column separator
add column corrnospx
add column corr50spx
add column corr0spx

draw corr(^SPX,2,close)
draw corr(^SPX,2,close) line at 1.0
draw corr(^SPX,2,close) line at -1.0
]



four
5,087 posts
msg #146373
Ignore four
modified
2/1/2019 2:35:54 PM

symlist(ge,aapl)

set{a,corr(^SPX,2,close)}
set{aa, count(a < .1,200)}
set{aaa, count(a < -.1,200)}

add column separator
add column aa
add column aaa
set{between, aa - aaa}
add column between



lis
37 posts
msg #146375
Ignore lis
2/1/2019 4:27:37 PM

Interesting alternative, four! Thanks!

four
5,087 posts
msg #146376
Ignore four
2/1/2019 5:05:42 PM

welcome

StockFetcher Forums · General Discussion · Correlation value confusion...<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.