Hi Jeff, Did some more investigation. Testing AAP I did notice some issues. For one, even QP data looks suspect with regard to TTM numbers. I've posted a question on the quotes-plus boards.
Also, AAP is missing a quarter completely (Fall 2002). But more importantly, AAP sometimes reports end of December, and sometimes end of January thus throwing off my calculations completely. So, what is needed is a more sophisticated algorithm. I did notice that the QP Excel plugin has a function called QP_QuarterDate() and this is the missing piece in my opinion. Because its possible for the company to completely miss a quarter and/or report inconsistently (AAP for instance sometimes reports end of December, and sometimes end of January), one cannot be sure how far back to go in AB timeline without knowledge of the data from QP_QuarterDate to properly calculate the TTM or simply to go back X number of quarters. Finally, I don't even know if QuarterDate info is accessible via GetExtraData. I didn't see any reference to this function in the GetExtraData docs. If this function is available through QP API, then perhaps GetExtraData needs to be aware of it somehow. I don't know if the QP plugin code is available for others to play with the ADK (AmiBroker Development Kit)? In the meantime, your solution probably is the best for now. Your differences may be due to quarters completely missing/not reported by a company? Maybe you need to find out how SPP and/or others like Yahoo/Reuters would handle such use cases.. Regards, JD --- In [email protected], Jeff Springer <[EMAIL PROTECTED]> wrote: > > Hi JD, > I put together a simple exploration using your 260/4 definition for quarters (e.g. EPS1=Ref(EPS,-1*qtrdays)) and imported the results into an Access database I set up to test for variances. I also imported the same data from SPP into the database to check the AB data against. Unfortunately, I get a lot of variances using this method (805 for Q1, 822 for Q2, 873 for Q3, etc.). On the TTM calculations I used your functions like this: AddColumn(getEPSTtm(),"TTMEPS"); I'm not a programmer so I may have used these incorrectly. When I checked it against the SPP data, 1037 stocks varied from the SPP data. Here are a couple from the EPS if you want to check them: AAP, AATK, ABIX, ADG. > > What I think happens is SPP just takes the last date the company reported and calls that QEPS. Many of the companies in the database haven't reported for several quarters, and most often several years. With my system these stocks get added into the TTM when, in actuality, their TTM is 0. The way I got around that was to get the last date of the report and filter out any stocks that reported before Nov. of last year. I also filter out any stocks with less than 500 bars in order to avoid IPOs or stocks that have less than 8 quarters of earnings. When comparing your method against the SPP data you'll show 0 EPSTTM when SPP will show something else. Still, I don't think there's enough of these "old stocks" to account for all the variances your code is showing. > > The way I deal with quarters that don't change is to look for either a change in Sales or a change in EPS. Even if EPS doesn't change (or change by much), sales should change at least fractionally. And they shouldn't change at different times. It doesn't catch every time there is a change, but I've managed to get down to 136 stocks that fail to match up to the SPP data 8 quarters back. I'm not too sure why, but I'm also not too sure these 136 stocks matter much. I did a filter in SPP with these criteria: common stock; Close between $3 and $50; 50dma of volume over 100,000; CQIE and CQIR both >=1; %EPSChg > 20; %RevChg>15; and ROE > 17. I used the same filter in AB. > > AB returned 14 stocks that SPP didn't, and SPP returned 16 stocks that AB didn't. The 14 stocks AB returned all match SPP data for CQIE, CQIR, and %Chgs. Perhaps they didn't show up in SPP because they're not common stocks, I don't know. But they would still be valid candidates. I'm not sure why AB didn't return 16 of the SPP stocks, perhaps these stocks don't have enough bars. I'll have to keep checking. However, 128 stocks were the same in both. Of those 128: all matched on CQIE and CQIR; all %Chges were within 1% (rounding error). That leaves me with 142 stocks with good fundamentals. The CANSLIM filter in SPP returns 165 stocks, so I'm close. > > The idea of just stepping back through quarters makes intuitive sense to me. But try as I might, I just can't get the numbers to match SPP when I try this method. I think it's because companies aren't very consistent in reporting. > > TTYL > Jeff > > JD Fagan <[EMAIL PROTECTED]> wrote: > Hi Jeff, > > I did read your subsequent posts after I had already replied (catching > up on my AB mailing list reading can be time consuming ;-) > > Anyways, I don't think I've thoroughly tested my functions against > many different companies so I suppose there probably are issues with > companies that don't report. Can you give some symbols that are > giving you some trouble and I'll try and test it out on my end? > > The farther back you go, this may move too far back into the quarter > (the approach I did). It may be better to do what you are doing > (checking for a change). However, what happens when the values happen > to be the same from one quarter to the next (rare, but possible I > would think)? Maybe good enough to use rough approximation like I did > of looking back into quarters and trying to make just past the > boundary of quarters? > > Some more info on my 260 number...what I did was calculate the # of > trading days per month (Avg = 20.92, Max = 23, Stdev = 1.44). Then, I > calculate the trailing # of days in a quarter for any month being the > starting month (Avg = 62.83, Max = 65, Stdev = 1.8). I assumed the > worse for any given starting point and thus used the max. So 65 days > * 4 = 260 days. I know its not perfect, but may be good enough since > the fundamental data doesn't go back that far for QP.. > > http://www.nyse.com/Frameset.html?displayPage=/about/1022963613686.html > http://www.nyse.com/pdfs/tradeday_06.pdf > > I actually haven't even used SPP (but its on my very very long To Do > List ;-) > > Regards, > > JD > > --- In [email protected], Jeff Springer <fatboycato@> wrote: > > > > Hi JD, > > Thanks for replying to both of my posts. I put together a data map > of the QP3 data that can be accessed from AB. I posted it on this > board under "GetExtraData Map" about a week ago (I think). > > > > I like your functions below and I'll give them a shot tonight. I > think I've come up with a solution to getting the EPS and Sales > numbers out of the array, but the further back in time I go the more > discrepencies I get between what I return and what SPP reports. Have > you noticed any discrepencies between what you get and what SPP > reports? I hesitate with solutions that look back in time a certain > number of days, as your code seems to suggest, only because most > companies don't seem to report very consistently. Then again, many of > the companies in the SPP database haven't reported for several > quarters, many for several years. I've coded to exclude those stocks > from my exploration, but maybe your code avoids that? > > > > Jeff > > > > JD Fagan <jd.fagan@> wrote: > > Not sure if this is useful to you, but I had written these functions > > awhile back which demonstrates an alternative non-looping way to look > > back into the array based QP data fields that should only change by > > quarter: > > > > THOUSAND = 1000; > > MILLION = THOUSAND * THOUSAND; > > > > function getSalesMrq() { > > return GetExtraData("Sales") * MILLION; > > } > > function getEPSMrq() { > > return GetExtraData("EPS"); > > } > > function getSalesTtm() { > > //Cycle through last 4 quarters and add up the getSalesMrq for TTM > > qtrDays = 260 / 4; > > salesMrq = getSalesMrq(); > > return salesMrq + Ref(salesMrq, -1 * qtrDays) + > > Ref(salesMrq, -2 * qtrDays) + Ref(salesMrq, -3 * qtrDays); > > } > > function getEPSTtm() { > > //Cycle through last 4 quarters and add up the getSalesMrq for TTM > > qtrDays = 260 / 4; > > epsMrq = getEPSMrq(); > > return epsMrq + Ref(epsMrq, -1 * qtrDays) + > > Ref(epsMrq, -2 * qtrDays) + Ref(epsMrq, -3 * qtrDays); > > } > > > > JD > > > > --- In [email protected], "fatboycato" <fatboycato@> wrote: > > > > > > Eureka! I think I figured it out. For those of you with QP3 data, > > > try this code to return the last 3 EPS reports: > > > > > > EPS=GetExtraData("EPS"); > > > Filter=1; > > > b=BarCount; > > > i=1; > > > EPS0=EPS[b-1]; > > > > > > do > > > { > > > EPS1=EPS[b-i]; > > > i++; > > > } > > > while (EPS1==EPS0 AND i<BarCount); > > > > > > do > > > { > > > EPS2=EPS[b-i]; > > > i++; > > > } > > > while (((EPS2==EPS0) OR (EPS2==EPS1)) AND i<BarCount); > > > > > > > > > //EPS1=Ref(EPS,-i); > > > AddColumn(EPS0,"EPS0"); > > > AddColumn(EPS1,"EPS1"); > > > AddColumn(EPS2,"EPS2"); > > > > > > I really can't believe it was this simple, so something's probably > > > wrong. But it seems to work. It could probably be more elegant, but > > > I'm happy with what I've got. I imagine we could build in the Sales > > > array as well. Once we know the value of i, everything else should > > > fall out and a near-Canslim exploration could be done. > > > > > > Any suggestions would be recommended. > > > --- In [email protected], "fatboycato" <fatboycato@> > > > wrote: > > > > > > > > Well, I'm stumped. I've tried just about every way I could think > > > of > > > > to get this accomplished, but I'm simply not smart enough to do > > > it. > > > > Hopefully, someone here is. > > > > > > > > I can't seem to iterate through an array to discover if a value is > > > > different from a base value. For example: suppose your array looks > > > > like this: > > > > 0,0,0,0,0,0,0,0,1,1,1,1,1 > > > > > > > > I want to look through that array and return "1" the first time it > > > > changes from 0 to 1. The problem is that arrays can't show up in > > > any > > > > kind of loop. I don't know the 1 is there, so I can't just look > > > > for "1". I need to look through the array and return the different > > > > value, whatever it may be. > > > > > > > > Here's an example of what the code would look like: > > > > > > > > I have an array. > > > > Look at the first number in the array and call it "x". > > > > Look at the second number in the array. If it's the same as "x", > > > > then look at the third number. If it's still the same, look at the > > > > fourth number, etc... > > > > Once you get to a number that is not "x", call that number "y". > > > > Stop looking for something other than "x". > > > > > > > > Any ideas? The Ref() function obviously won't work because it > > > > returns an array. Is there another function that works like Ref(), > > > > but returns a single value? > > > > > > > > > > > > > > > > > > > > > > > Please note that this group is for discussion between users only. > > > > To get support from AmiBroker please send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > For other support material please check also: > > http://www.amibroker.com/support.html > > > > > > > > > > > > --------------------------------- > > YAHOO! GROUPS LINKS > > > > > > Visit your group "amibroker" on the web. > > > > To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service. > > > > > > --------------------------------- > > > > > > > > > > > > --------------------------------- > > Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low > rates. > > > > > > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For other support material please check also: > http://www.amibroker.com/support.html > > > > > > SPONSORED LINKS > Investment management software Real estate investment software Investment property software Software support Real estate investment analysis software Investment software > > --------------------------------- > YAHOO! GROUPS LINKS > > > Visit your group "amibroker" on the web. > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > --------------------------------- > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
