PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Thank you, Gary, yes it makes sense now.
<FONT face=Arial
color=#0000ff size=2>Do you know where I can find the final/best code for
this ranking approach?
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>The ROC part of the code could be made faster by only addressing the
bars you need, see the comparison of the two methods below. DebugView shows an
about 5-6 times improvement.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>best regards,
<FONT face=Arial color=#0000ff
size=2>herman
<FONT face=Arial color=#0000ff
size=2>
<FONT
face=Arial>Buy<FONT
color=#000000>=Sell<FONT
color=#000000>=Short<FONT
color=#000000>=Cover<FONT
color=#000000>=0<FONT
size=2>; <FONT
color=#ff0000>Filter=<FONT
color=#0000ff>Status(<FONT
color=#ff00ff>"LastBarInTest") <FONT
color=#ff0000>AND <FONT
color=#ff0000>BarCount-<FONT
color=#ff00ff>1 > <FONT
color=#ff00ff>252<FONT
color=#000000>; SetOption<FONT
color=#000000>("NoDefaultColumns"<FONT
color=#000000>,<FONT
color=#ff0000>False<FONT
face=Arial>); Price = <FONT
color=#ff0000>Open<FONT
face=Arial>; //
using numbers (fast)<FONT
face=Arial> b=<FONT
color=#ff0000>BarCount-<FONT
color=#ff00ff>1<FONT
color=#000000>; RankNum = (Price[b]/price[b-<FONT
color=#ff00ff>62]*<FONT
color=#ff00ff>2<FONT
color=#000000>+ Price[b-63<FONT
color=#000000>]/Price[b-125<FONT
size=2>]+ Price[b-<FONT
color=#ff00ff>126]/Price[b-<FONT
color=#ff00ff>188<FONT
color=#000000>]+ Price[b-189<FONT
color=#000000>]/Price[b-251<FONT
color=#000000>])/5<FONT
size=2>; <FONT
color=#000000>// using arrays (slow)<FONT
size=2> RankArray = Price/<FONT
color=#0000ff>Ref(Price,-<FONT
color=#ff00ff>62)*<FONT
color=#ff00ff>0.4<FONT
color=#000000>+ Ref<FONT
color=#000000>(Price,-63<FONT
color=#000000>)/Ref<FONT
color=#000000>(Price,-125<FONT
color=#000000>)*0.2<FONT
size=2>+ <FONT
color=#0000ff>Ref(Price,-<FONT
color=#ff00ff>126)/<FONT
color=#0000ff>Ref(Price,-<FONT
color=#ff00ff>188)*<FONT
color=#ff00ff>0.2<FONT
color=#000000>+ Ref<FONT
color=#000000>(Price,-189<FONT
color=#000000>)/Ref<FONT
color=#000000>(Price,-251<FONT
color=#000000>)*0.2<FONT
size=2>; <FONT
color=#0000ff>AddColumn(RankNum,<FONT
color=#ff00ff>"RankNum",<FONT
color=#ff00ff>1.2<FONT
color=#000000>); AddColumn<FONT
color=#000000>(RankArray,"RankArray"<FONT
color=#000000>,1.2);
<SPAN
class=840382007-06012004><FONT
color=#0000ff>
<SPAN
class=840382007-06012004> -----Original Message-----From:
gary_tiger2001 [mailto:gary_tiger2001@xxxxxxxxx]Sent: January 6, 2004
1:28 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Re: How to test IBD's idea?
Herman,I think the absolute
value of ROC cannot tell you how strong one stock is without comparing to
the ROC of other stocks. So ROC ranking/relative strength ranking gives us
a better pic how well a stock is performing within the whole universe of
stocks.We may need to know the top 10 percent for long, and maybe
bottom 20 percent to short. It all depends how we are going to use it. But
anyway we need to sort the whole 3000 stock first.Hope it answers
your question.Gary--- In amibroker@xxxxxxxxxxxxxxx, "Herman
vandenBergen" <psytek@xxxx> wrote:> Ace/Gary,>
> This is probably a very dumb question but could you explain why
you need an> integer Ranking number if you already have ROC Ranking
number? I am missing> somethin basic...> > Another
question is whether you need to know the rank of all 3000 stocks
or> only the top 100?> > You comments will be much
appreciated!> herman.> -----Original
Message-----> From: acesheet
[mailto:acesheet@xxxx]> Sent: January 6, 2004 11:22
AM> To: amibroker@xxxxxxxxxxxxxxx>
Subject: [amibroker] Re: How to test IBD's idea?> >
> Gary,> > I see that you are
basically placing the ROC of whatever stock you> are
analyzing in the particular order within the 'ROC stackup'
for> the day under consideration.>
> What you are doing is pretty much the same thing I did,
but in a> different way. So it is a pure statistical
stackup in that sense and> is the proper way of
performing a ranking. It is very slow and> memory consuming
for a large watchlist though. I like the results,> but
it sure takes some time! It seems correct.> > In
terms of Exploring for RS stocks you'll find the code I
presented> is much faster, once the calibration indices
are created (~xroc and> ~yrank). It does the same thing
that you did, but it only needs to> create the stackup
once. My code creates a reference index that> stores the
stackup information for today, whereas yours creates
it> for each stock you are scanning, which is why it
takes so long. Mine> takes a long time, but only once
per day. The RS calculation then> references the stored
information, which makes it a lot quicker.> > This
is good work though. I'll be able to refer back to it for
ideas> I think.> > Take that
for what its worth.> > -ace> >
> --- In amibroker@xxxxxxxxxxxxxxx,
"gary_tiger2001"> <gary_tiger2001@xxxx>
wrote:> > Ace,> > Please check my
code below, it looks much simpler. It can rank from>
> 1 to 100. But the exploration is really slow for big database. I
am> > trying to reduce the calculation amount before I
can use it for> > daily exploration.>
>> > //replace your watchlist number with
15> > list = CategoryGetSymbols( categoryWatchlist, 15
);> > p = 20;> >
Count=0;> > rank = 0;> > symVal =
0;> > relval = 0;> > Ownval =
ROC(C,p);> > for( i = 0; ( sym = StrExtract( list, i ) )
!= ""; i++ )> > {> > symVal =
Nz(Foreign( sym, "Close" ));> > relval = ROC(symval,
p);> > n=Nz(IIf(relVal!=0,1,0));>
> Count[BarCount-1]=Count[BarCount-1]+n[BarCount-1];>
> if(relval[BarCount-1] > Ownval[BarCount-1])> >
rank[BarCount-1] = rank[BarCount-1]+1;> >
}> > AddColumn(Count,"count",1.0);>
> AddColumn(rank,"rank",1.0);> > rank[BarCount-1] =
int(100*(Count[BarCount-1]-rank[BarCount->
1])/Count> > [BarCount-1]);>
>> > Filter = 1;> >
AddColumn(Ownval,"ROC",1.2);> >
AddColumn(rank,"rank",1.0);> >>
>> > Gary,>
>> >> > --- In
amibroker@xxxxxxxxxxxxxxx, "acesheet" <acesheet@xxxx>
wrote:> > > JOE,> >
>> > > I'm 99% certain the way I propose to
calculate the IBD RS *is*> the> >
> way that it is done in terms of comparing relative strength on
a> > > purely statistical basis. If you look in Excel
at the> PERCENTRANK> > > function
you'll see that it does essentially the same thing as>
> what> > > I designed in AFL for this
code.> > >> > > Other
formulations may try to approximate the IBD number -
I've> > > designed a few of those myself - but
they aren't really doing> what> >
> the essence of the 1-99 comparison is. The code I showed
does> > > exactly what a RS Rank compared to all
stocks in the database> and> >
is> > > not really an approxiamtion, except for the
11 point curve fit> of> > >
the CPD curve.> > >> > > The
only difference between the one I show and IBD's is that>
they> > do> > > some weighting
of either more than one ROC going into the CPD> > >
comparison. I don't know what IBD's weightings are, but
I'm> pretty> > > sure it doesn't
matter all that much as long as the idea finds> >
high> > > RS stocks to trade. In other words I really
don't think it> matters> > > if
IBD says a stock is an 88 and this calculation says its a
84.> > >> > > Have
fun.> > >> > >
-ace> > >> > > --- In
amibroker@xxxxxxxxxxxxxxx, "Joseph Landry">
<jelandry@xxxx>> > > wrote:>
> > > Ace - I subscribe to the forum digest so I don't get
any> > > > attachments, and I'm wondering if you
could forward the AFL> code> > >
to> > > > me directly?> >
> >> > > > The folks over in the TC2000 area
have a way of calculating> what> >
> > they say is IBD relative strength number and as soon as I
find> > it> > > > and
the underlying rationale I'll post it here.> > >
>> > > > Thanks> > >
> JOE> > > >> > > >
--- In amibroker@xxxxxxxxxxxxxxx, "gary_tiger2001"> >
> > <gary_tiger2001@xxxx> wrote:> > >
> > Thanks Ace, Harvey & Jason,> > > >
>> > > > > I will study the
code...> > > > >> > >
> > Cheers,> > > > >
Gary> > > > > --- In amibroker@xxxxxxxxxxxxxxx,
"acesheet" <acesheet@xxxx>> > >
wrote:> > > > > > Gary,>
> > > > >> > > > > > There's
a couple of different ways of doing it. Some more> >
time> > > > > > consuming, some less. One
way is to compare the returns> >
using> > > > ROC> > >
> > to> > > > > > a reference index
(like SP500 or Value Line for US>
stocks).> > If> > >
a> > > > > > stock's performance
significantly beats out the index,>
then> > > its> > > >
a> > > > > > safe bet that it has high
relative strength. I've used> this> >
> > > concept> > > > > > for back
testing.> > > > > >> >
> > > > Another way is to use what's called the
'Cumulative> > > Probability'>
> > > > of> > > > > > the market
returns. See post # 55179. If you have a large> >
> enough> > > > > > database you should
be able to get these AFL scripts to>
work> > > > very> > >
> > > well in terms of comparison with IBD's RS ranks.
Currently> I> > > >
only> > > > > > have a script that uses
"today's" data however, so it> won't>
> be> > > > so> > >
> > > hot for backtesting. This method of ranking works
very> well.> > > > >
>> > > > > > You could take the idea
shown in post 55179 and adapt it>
to> > > > > collect> >
> > > > the data over time and create several historical
ROC> indices> > >
for> > > > > the> > >
> > > 10 point curve fit. Something like> >
> > > ~xroc1,~xroc10...~xroc90,~xroc99.> > >
> > > It will probably take AB a very long time to crunch
the> > > numbers,> > > >
> > however.> > > > >
>> > > > > > Hope that gives you some
ideas.> > > > > >> >
> > > > -ace> > > > >
>> > > > > > --- In
amibroker@xxxxxxxxxxxxxxx, "gary_tiger2001"> > > >
> > <gary_tiger2001@xxxx> wrote:> > >
> > > > Happy new year to all of you.> >
> > > > >> > > > > > > I
wish to test the idea from IBD, like the relative> >
> strenghth> > > > > > > ranking, etc.
I cannot figure out how to do it in AB.> > > >
Basically,> > > > > I> >
> > > > > have a universe of stocks. Is it possible to rank
the> > > strength> > > >
> of> > > > > > > stocks compared to
my stock universe, from 1 - 99?> > > > > >
>> > > > > > >
Cheers,> > > > > > > Gary>
> > > Send BUG REPORTS to
bugs@xxxx> Send SUGGESTIONS to
suggest@xxxx>
-----------------------------------------> Post
AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx> (Web page: <A
href=""><FONT face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>>
--------------------------------------------> Check group
FAQ at:> <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
face=Arial size=2>> >
> Yahoo! Groups
Sponsor>
ADVERTISEMENT> > > > > >
---------------------------------------------------------------------------->
--> Yahoo! Groups Links>
> a.. To visit your group on the web, go
to:> <A
href=""><FONT face=Arial
size=2>http://groups.yahoo.com/group/amibroker/<FONT face=Arial
size=2>> > b.. To unsubscribe from this
group, send an email to:>
amibroker-unsubscribe@xxxxxxxxxxxxxxx> >
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.Send BUG
REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check group
FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
size=2>
<FONT
face=Arial size=2>
Yahoo! Groups Links
To visit your group on the web, go
to:<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/<FONT
face=Arial size=2>
To unsubscribe from this group, send an email
to:<A
href=""><FONT
face=Arial size=2>amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT
face=Arial size=2>
Your use of Yahoo! Groups is subject to the
<FONT face=Arial
size=2>Yahoo! Terms of Service.
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 Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|