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

[amibroker] Re: Portfolio Testing and RANK() [was Bugged out ]



PureBytes Links

Trading Reference Links

Rich,

Ranking can be a simple or complex issue depending on how one thinks 
about and then goes about doing the process and what one is going to 
do with the results.  

To my way of thinking ranking is nothing more then ordering a list of 
items that have been "scored" for some particular bar based on 
whatever the users criteria for scoring is.  For example let's assume 
you want to rank a list of securities based on how they "score" in 
RSI where for the sake of argument high numbers are perceived to be 
good and low bad.  It is easy enough to process a watchlist of items 
scoring them on this basis and then sorting the list in an 
exploration.  This is a form of scoring and ranking that AB is 
already capable of.  

The question now is what does one want to do with the scored and 
ranked list ?  Buy the top candidates and/or short the bottom ?  This 
becomes a little trickier but could be done by storing the results 
from the exploration and then referencing the scored and ranked list 
in a back test AA.  

Beyond these simple examples and capabilities it is possible using 
ABTool to score and rank on the fly so that following the initial 
processing of the watchlist in an AA one has the top long/short 
candidates in a table that can then be used to drive buy and sell 
signals in the same run.  Once one has consolidated the scoring, 
ranking & trading to a single run, one can if desired heap 
optimization on top allowing for a fully functional scoring / 
ranking / trading / equity curve evaluation AA to be written that 
also allows one to perform optimization.

Fred

--- In amibroker@xxxxxxxxxxxxxxx, "rlb21079" <rlb21079@xxxx> wrote:
> I had not realized how complex this issue was.  Certainly, by my 
> efforts, I now realize it is not easy to do - now.  But I hadn't 
> realized how difficult it would be to build in.  Of course, it 
makes 
> sense because it seems a good rule of thumb: if it is reasonable to 
> do Tomasz has already done it.
> 
> It would be interesting maybe to have a companion product to Ami to 
> do this type of ranking/filter.  Much like AmiQuote works hand in 
> hand with AmiBroker.  I imagine that this software could load small 
> amounts of data at a time - so as to avoid the storage issue.  But 
if 
> it referenced one's normal ticker database per request, and then 
> created a new quasi-rigid database of its own it could then operate 
> at high speeds.
> 
> I am however, but a 'tinkerer' when it comes to programming and 
thus 
> know little of the implications of such a project.  The bottom line 
> is I too am very thankful for Tomasz and Ami.  I really couldn't 
> imagine using any other piece of software.
> 
> -Rich
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "b519b" <b519b@xxxx> wrote:
> > Rich:
> > 
> > Like you, I am looking forward to a function like RANK(). 
Hopefully 
> > it will not be too long before AB gets new abilities for ranking 
> and 
> > portfolio testing.
> > 
> > Adding items like RANK() will take AB to a new level of 
usefulness -
>  
> > but it will not be a trival task. As users we are fortunate that 
> > that a man with Tomasz's talents and dedication is developing AB. 
> > 
> > Some months ago, Tomasz explained that adding functions that do 
> > ranking is not a simple task. If my memory is correct, the 
> challenge 
> > has to do with giving AB new procedures for processing data. 
Right 
> > now AB is oriented to look at only 1 stock at a time. This has 
> > several advantages for the user. First it allows AB to be very 
fast 
> > at drawing charts, calculating indicators, and doing backtesting 
on 
> > individual stocks. It means that AB can run very well on 
computers 
> > that do not have 2 or more GBs of RAM. There are advantages for 
> disk 
> > storage as well.
> > 
> > In addition to AB, I use another stock program that has been 
> > oriented from the ground up for Ranking stocks. That program is 
> > lightening fast at ranking: less than 1 second to rank 7,000 
> stocks. 
> > Compare that to how long it takes an AB scan to rank 7,000 
stocks. 
> > However, all is not perfect with my other program - it is VERY 
slow 
> > at charting. Unbelievably slow! The reason is its data base 
design 
> > was optimized for ranking. The by produce is slow charting (and 
> slow 
> > indicator calcuations). 
> > 
> > The other by product of that program is limited stock history. To 
> be 
> > optimized for ranking, the other program has all of its data in 
one 
> > large database. This approach quickly outgrows database limits. 
My 
> > other program recently had to be upgraded from a MS Access 
> structure 
> > with a 1 GB limit to an MS SQL server structure (with a 2 GB 
limit -
>  
> > larger available for higher cost). The 1 GB database can not hold 
> > much more than 3 years of data. The newer one has a twice the 
> limit, 
> > but appears to be less efficent in storage: it takes about 1/3 to 
> > 1/2 GB/year of data, so its maximum is 4-5 years of data - not a 
> lot 
> > more than what it replaced! Compare that to the virtually 
unlimited 
> > data that AB can hold due to its 1 file per stock approach to 
data 
> > storage. 
> > 
> > Over all, AB's approach is much to be preferred in my view. 
> However, 
> > that approach is, at its heart, to treat one stock at a time, 
both 
> > for storage on the hard disk and for charting and for testing. 
> > Adding a function like RANK() that you suggest, would add new 
> > requirements to AB, including:
> > 
> > 1. AB will have to syncronize dates between all the stocks -- it 
> > currently does not have to do this for most charting and testing, 
> > expect in a limited way when making a Foreign() call or using 
> > AddToComposite().
> > 
> > 2. AB will have to have some new internal arrays to store the 
> > rankings. That will be mean least one array for every data bar, 
> > which might not sound like much if a user just wants the top 5, 
10, 
> > 20 or 50 rankings for each day (data bar), but it can add up very 
> > quickly if the user wants ALL the stocks ranked for every data 
bar. 
> > That could be a 2D array with 7,000 (stocks) in one direction and 
> > nearly 4,000 (15 years of 250 days) in the other: 28 million 
cells. 
> > And what if the user wants to test the interactions of 3 
different 
> > ranking arrays. Demands for RAM (and CPU power for sorting) could 
> be 
> > at a premium and intelligent programming a must. 
> > 
> > 3. There are probably many more issues that would need to be 
> > overcome.
> > 
> > In short, as users we are fortunate that that a man with Tomasz's 
> > talents and dedication is developing AB. Adding items like RANK() 
> > will take AB to a new level of usefulness - but it will not be a 
> > trival task. 
> > 
> > -------------
> > 
> > 
> > like RANK()
> > --- In amibroker@xxxxxxxxxxxxxxx, "rlb21079" <rlb21079@xxxx> 
wrote:
> > > Thanks for the tips.  I have read the Users Guide twice and 
have 
> > > searched it for specifics often.  The ROC() is a useful 
funtion, 
> > but 
> > > right now will not be of much use.  My problem biggest problem 
> has 
> > > been my inability to compare one ticker to another, or more 
> > > specifically one ticker's volume to the volume of all other 
> > tickers 
> > > in a market.  This seems to be the essential aspect to creating 
a 
> > > ranking of stocks, as per volume, change in price, ROC(), or 
> > > whatever.  There doesn't seem to be a function like say RANK(), 
> > the 
> > > parameters of which might be: "Ticker for 
> > > comparison," "Group/Market/Watchlist for comparing," "Array to 
> > > compare"
> > > 
> > > There, of course, could be many variations on a function such 
as 
> > this 
> > > and I haven't thought them through - but it would be useful.
> > > 
> > > It would allow for the creation of Composite Tickers based on 
> such 
> > > popular measures as Most Active per Volume, per percentage 
> change, 
> > > per percentage increase in volume, etc.
> > > 
> > > Thankyou for your time,
> > > -Rich
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, Udo.Harke@xxxx wrote:
> > > > Rich,
> > > > 
> > > > maybe you should devise a selection of those particular 
stocks 
> > > based on the AFL library function ROC() by comparing today's 
> > progress 
> > > ( > 0) versus the preceding day's change of price (> 0 too) 
> > expressed 
> > > as percentage?
> > > > 
> > > > Some information about this function is also contained in the 
> > > User's Guide which is a companion product issued with AmiBroker!
> > > > 
> > > > Best regards,
> > > > 
> > > > Udo
> > > > 
> > > >   -----Ursprüngliche Nachricht----- 
> > > >   Von: rlb21079 
> > > >   An: amibroker@xxxxxxxxxxxxxxx 
> > > >   Gesendet: Sonntag, den 25. Mai 2003 22:58 Uhr
> > > >   Betreff: [amibroker] Re: Bugged out (1)
> > > > 
> > > > 
> > > >   I'm very sorry to all reading my previous posts.  Esp. 
> > Tomasz.  I 
> > > >   wanted to create a composite ticker holding each day a 
single 
> > > value 
> > > >   comprised of the sum of the direction of change for the 15 
> > most 
> > > >   active stocks of that given day.  If the 15 most actively 
> > traded 
> > > >   stocks were all positive, then value would be +15, if all 
but 
> > one 
> > > >   then value would be +13...etc.  I inteded the requirement 
of 
> > the 
> > > >   rangefrom and rangeto dates to be the same b/c I figured I 
> > needed 
> > > to 
> > > >   run the explore once for every day I wanted to calculate 
the 
> > > number.  
> > > >   The code wasn't done, this was just the first couple steps 
to 
> > > isolate 
> > > >   the 15 most actives, but I really can't figure any other 
> way.  
> > > I'll 
> > > >   get more practice with something easier and hopefully be 
able 
> > to 
> > > do 
> > > >   this later.
> > > >   All the best,
> > > >   Rich
> > > > 
> > > > 
> > > > 
> > > > 
> > > >         Yahoo! Groups Sponsor 
> > > >        
> > > >        
> > > > 
> > > >   Send BUG REPORTS to bugs@xxxx
> > > >   Send SUGGESTIONS to suggest@xxxx
> > > >   -----------------------------------------
> > > >   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 
> > > > 
> > > >   Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> > > Service.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

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