[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Single Value from Array



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, Jeff Springer <fatboycato@xxx> 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@xxx> 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 amibroker@xxxxxxxxxxxxxxx, "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 amibroker@xxxxxxxxxxxxxxx, "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:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>     
>     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.
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/