| siliconhippy 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
 --------------
 
 LEGEND:
 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)
 
 
 Regards,
 
 siliconhippy.
 
 
 
 
 
 | 
| cegis 235 posts
 msg #32249
 - Ignore cegis
 | 6/3/2004 2:35:51 PM 
 siliconhippy,
 
 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!
 
 HTH,
 
 C
 
 
 
 |