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

[amibroker] System Timing Problem



PureBytes Links

Trading Reference Links

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 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/