StockFetcher Forums · Filter Exchange · Need help with Rsquared filter...<< >>Post Follow-up
37 posts
msg #32235
Ignore siliconhippy
6/2/2004 11:41:59 PM

Hey Folks,

Was trying to write an Rsquared (coefficient of determination)filter as below, but must have had syntax errors (0 matches.)

Rsq values vary between 1 and 0, 1 being a perfect straight line chart.

See legend after filter. Please help !

Rsq>0.90UpVol FILTER
set{avgvalue, sum(close,90)/90}
set{sqdiff, (close - avgvalue)*(close - avgvalue)}
set{SSE, sum(sqdiff, 90)}
set{SST, (90*standard deviation(90)*standard deviation(90))}
set{Rsq, (1- SSE/SST)}
show stocks where Rsq is above 0.90 and average volume is above 100000 and volume is above 125000 and volume has been increasing for 3 days

Where Rsquared= 1 - SSE/SST

SSE = Sum [(Y(i)-avgY(i))**2] over all i=1,...,n, say n= last 90 days SST = Sum[Y(i)**2] - (1/n)* [SumY(i)}**2 avgY(i)= Sum Y(i)/n = SUM(close,90)/90 where n=90

Therefore, SST(n) = n * standard deviation(90)**2 n=90
SF has the above function, as STANDARD DEVIATION(period, avg period) and also SUM(IND, LENGTH)



235 posts
msg #32249
Ignore cegis
6/3/2004 2:35:51 PM


If I'm not mistaken, you can only use one arithmetic operation per set{} command. Therefore, you'll need to break apart lines 2, 4 and 5 into multiple set{}'s. (Eg., for line 2 you'd need set{sd1,close - avgvalue} set{sqdiff, sqd1 * sqd1})

Oh, yeah. There's a rsquared function now, too!



2 posts
msg #32266
Ignore bdfox
6/4/2004 1:36:35 PM

R squared function already exists but the annoucement of it may have gotten corrupted use "R squared(14)" ref for a 14 day period

StockFetcher Forums · Filter Exchange · Need help with Rsquared filter...<< >>Post Follow-up

*** Disclaimer *** 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. does not recommend particular securities., 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 2018 - 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