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

[amibroker] Re: Top 200 stocks by volume



PureBytes Links

Trading Reference Links

Andrew,

Thanks for looking into the problem and the mod to the code. 
Realistically the stock numbers (ie: Top 200) roughly within a 5%
range 
shouldn't really be a huge problem anyway. Another option could be to 
up the top stock variable to say 210 to get an average of 200.

It would still be good to get it "more" precise at a "trade off" of 
removing stock with holes in the data. Anyway as you say, I'm not too 
interesting in trading stocks with holes either!

> I've finally been able to reproduce your finding.

What are you doing to stop this from happening? Do you run a scan to 
add stocks with no data holes to a watchlist and run this code on
that?

> What market are you trading  - ASX ?

How'd you guess :-)

I'd like to replace the index with this idea mainly because of the 
backtesting bias in using todays ASX200 over 5 years.

Checking out the composite it's really interesting to see the
turnover 
over the past 5 years especially during the tech boom.

> I'll get back to you when I've finished.

Thanks, Dave

--- In amibroker@xxxxxxxxxxxxxxx, "Andrew Perrin" <adjp@xxxx> 
wrote:
> Dave
> 
> I've finally been able to reproduce your finding.  This occurs when 
there are Data holes (no trading days) in the shares being analysed. 
A 
partial fix is to modify the following line
> 
>     for (j=0; (sTicker = StrExtract( List,j)) != ""; j++)
>     {
> >    SetForeign(sTicker);
>     Rank = Ranking(Sov1,Sov2,Sov3,Sov4);
>     k = StartBar;
> 
> to  SetForeign(sTicker,false);
> 
> This will prevent filling data holes (see helpfile SetForeign -
Fixup), 
but this is only a partial fix.  The Data holes still cause problems
> Run this small exploration and you will find that the Ref Date
array is 
different if there are data holes.  In the Ranking AFL I posted,
everything 
is referenced back to the current stock periods (ie. the indexes 
periods).  This means that a 250 period MA looks at our SetForeign 
Ticker for 250 index periods.  The Second AFL you posted calculates
the 
250 period MA over 250 Ticker periods.  Data gaps will result in
different 
calculations for the MA.
> // Apply to - Use Filter - set to desired watchlist
> 
> // Range From - set date To - Same date (one day range)
> 
> Refdate = Ref(DateNum(),-20);
> 
> Filter = 1;
> 
> AddColumn(Refdate,"Ref Date",1.0); 
> 
> The Solution,  A start would be to remove tickers from your
watchlist 
that have data holes (realistically only those that have excessive
holes).  
If your like me, You wouldn't want to trade something that doesn't
trade 
every day anyway.  The Total solution would be to have the AFL reject 
tickers that trade less than a certain % of periods.  I'm working on 
something related to this in another project.  I'll get back to you
when 
I've finished.
> 
> Out of interest, What market are you trading  - ASX ?
> 
> Andrew 
> 
> 
> 
> 
>   ----- Original Message ----- 
>   From: dcrotty2003 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Sunday, December 21, 2003 8:40 PM
>   Subject: [amibroker] Re: Top 200 stocks by volume
> 
> 
>   Hi Andrew,
> 
>   Yes, I did run the ranking using Turnover=MA(V*C,250) in it.
> 
>   Another thing I have just done is run this:
> 
>   Filter=MA(V*C,250);
>   SetOption("NoDefaultColumns", True);
>   AddTextColumn( Name(), "Ticker", 77);
>   AddColumn( DateTime(), "        Date        ", formatDateTime);
>   AddColumn( Close, "   Close   ", 1.3);
>   AddColumn(MA(V*C,250), "Turnover", 1);
> 
>   ...on a single date and exported the data to a CSV file and on
sorted
>   the 
>   volume top to bottom.
> 
>   I compared it with the same date on the ~TurnoverTop200 and the 
>   value in the ~TurnoverTop200 would catch around 180 stocks when 
>   looking at the volume in the csv file. Thanks.
> 
>   Dave
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Andrew Perrin" <adjp@xxxx> 
>   wrote:
>   > Dave
>   > Had to think about this one, I noticed you have used Turnover=MA
>   (V*C,250) . This is not the turnover calculation used in the
initial 
>   Ranking AFL, did you modify that ranking calculation as well, if
not
>   that 
>   is the reason for the discrepancy.  It does work for me. 
>   > 
>   > >BTW I would like to do an Explore on single day (say on
>   01/01/2003) 
>   > >using for an example: MA(V*C,250) so I can do a sort in AA to 
see 
>   what 
>   > >the actual Top 200 stocks symbols were. I've tried a few thing 
but 
>   I'm 
>   > >not sure how to set it up in the AA and what range to set (ie:
>   does it 
>   > >need to be back 250 days for the 250 day MA) ?
>   > 
>   > Just set Range From - 01/01/2003 To - 01/01/2003 and explore.  
No 
>   you don't have to worry about 250 day MA, Amibroker takes care of
>   that 
>   for you.
>   > 
>   > Andrew
>   > 
>   > 
>   >   ----- Original Message ----- 
>   >   From: dcrotty2003 
>   >   To: amibroker@xxxxxxxxxxxxxxx 
>   >   Sent: Sunday, December 21, 2003 8:40 AM
>   >   Subject: [amibroker] Re: Top 200 stocks by volume
>   > 
>   > 
>   >   Hi Andrew,
>   > 
>   >   I just did a simple scan to see exactly how many stocks were
>   above 
>   the 
>   >   turnover formula in the rank code ie:
>   > 
>   >   Turnover=MA(V*C,250)  >= Foreign("~TurnoverTop200","C");
>   >   Buy = 0;
>   >   AddToComposite(Turnover, "~StockNum", "X" ); 
>   > 
>   >   ...I found the number of stocks picked on a day varies between
>   170 
>   & 
>   >   180 or so, rather then 200. Do you know why this would be? 
Thanks.
>   > 
>   >   BTW I would like to do an Explore on single day (say on
>   01/01/2003) 
>   >   using for an example: MA(V*C,250) so I can do a sort in AA to 
see 
>   what 
>   >   the actual Top 200 stocks symbols were. I've tried a few thing
>   but 
>   I'm 
>   >   not sure how to set it up in the AA and what range to set (ie:
>   does it 
>   >   need to be back 250 days for the 250 day MA) ?
>   > 
>   >   Dave
>   > 
>   > 
>   > 
>   >   --- In amibroker@xxxxxxxxxxxxxxx, "Andrew Perrin" 
<adjp@xxxx> 
>   >   wrote:
>   >   > Dave
>   >   > Good to hear you got it working.  I don't run this exact
scan,
>   but 
>   yes I 
>   >   do run a ranking scan daily.  I contributed the Turnover
Ranking
>   as 
>   an 
>   >   example,  Perhaps of interest to you was a discussion on 
whether 
>   this 
>   >   particular formula for turnover was the best as opposed to
MA(V 
* 
>   >   Close ,sov1). 
>   >   > see http://groups.yahoo.com/group/amibroker-
ts/message/596 
>   for 
>   >   this discussion
>   >   > >Just add MA(V,sov1) * Close >= foreign
>   >   > >("~Top200Vol","C"); to my system and that's it. Does that
>   sound 
>   OK?
>   >   > What you suggest sounds right to me
>   >   > Andrew
>   >   > 
>   >   > 
>   >   >  
>   >   > 
>   >   > ----- Original Message ----- 
>   >   >   From: dcrotty2003 
>   >   >   To: amibroker@xxxxxxxxxxxxxxx 
>   >   >   Sent: Saturday, December 20, 2003 4:22 PM
>   >   >   Subject: [amibroker] Re: Top 200 stocks by volume
>   >   > 
>   >   > 
>   >   >   Andrew,
>   >   > 
>   >   >   Excellent!! :-) got it going, thanks for your time and
your
>   code. I 
>   >   didn't 
>   >   >   understand how it worked and now that I see it on a
chart, I 
>   doesn't 
>   >   >   look like it's necessary to do it month by month as I
>   mentioed in 
>   my 
>   >   >   previous post. Just add MA(V,sov1) * Close >= foreign
>   >   >   ("~Top200Vol","C"); to my system and that's it. Does that
>   sound 
>   OK?
>   >   > 
>   >   >   Do you run this daily prior to Scaning for signals?
>   >   > 
>   >   >   Thanks again.
>   >   >   Dave


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/