StockFetcher Forums · Filter Exchange · basket correlation filter<< >>Post Follow-up
fotchstecker
295 posts
msg #155904
Ignore fotchstecker
modified
2/21/2021 11:30:57 AM

Here's a simple correlation filter for constructing a basket of symbols with varying correlations to SPY (or any symbol) over various periods. Just uncomment/comment-out the correlation range you want to use for a strongly, neutrally, or inversely correlated symbol. Adjust the correlation values as needed, too.

Improvements are welcomed, and any other methods you might have for constructing baskets based on correlation would be welcomed, too. Enjoy.


Fetcher[
/*
Tool for constructing a basket, starting with correlations to SPY
*/

market is ETF
add column Historical Volatility(100,1)
and add column corr(SPY,30,Close)
and add column corr(SPY,60,Close)
and add column corr(SPY,90,Close)
and add column corr(SPY,150,Close)
and add column beta
and add column industry
and add column sector

close < 500

sort ascending column 5

/*correlated
corr(SPY,30,Close) > .80
corr(SPY,60,Close) > .82
corr(SPY,90,Close) > .84
corr(SPY,150,Close) > .86
*/

/*neutral
corr(SPY,30,Close) between -.4 and .4
corr(SPY,60,Close) between -.4 and .4
corr(SPY,90,Close) between -.4 and .4
corr(SPY,150,Close) between -.4 and .4
*/

/*inverse
corr(SPY,30,Close) < -.8
corr(SPY,60,Close) < -.8
corr(SPY,90,Close) < -.8
corr(SPY,150,Close) < -.8
*/
]



novacane32000
330 posts
msg #155918
Ignore novacane32000
2/22/2021 8:43:03 AM

Very nice ! Thank you

glgene
590 posts
msg #155922
Ignore glgene
2/22/2021 5:31:15 PM

I agree —- Very Nice!

graftonian
1,089 posts
msg #155924
Ignore graftonian
2/22/2021 6:06:05 PM

A handy tool, I'll add it to my basket of tricks.
Graf

snappyfrog
501 posts
msg #155935
Ignore snappyfrog
2/23/2021 4:59:48 PM

Nice, thanks.

nibor100
924 posts
msg #155937
Ignore nibor100
2/24/2021 11:33:10 AM

A couple of additional filter lines, that may be of interest to some, for adding different graphic comparisons to spy.

compare with spy

add column relative strength(spy,30) > -1

Ed S.



fotchstecker
295 posts
msg #155960
Ignore fotchstecker
2/25/2021 9:13:13 PM

Ed, thanks. A simple improvement -- my favorite kind! Thanks.

StockFetcher Forums · Filter Exchange · basket correlation filter<< >>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.