PureBytes Links
Trading Reference Links
|
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@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 ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
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/
|