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

[amibroker] Re: Ranking Stocks (AFL or via scripting)



PureBytes Links

Trading Reference Links

Chuck,

I had been toying with this idea prior to ABTool being available 
which I haven't investigated yet and boiled the process down to:

1.  AFL - Rank all stocks for each bar and produce an Explore with 
Date, Symbol (Superfluous), StockNum, Score & Signal (Buy(1) & Short
(2) but this could also contain values for Sell & Cover).

2.  Export the Exploration file for manipulation.

3.  Manipulate the file by eliminating all but the highest/lowest 
ranked stocks for each day (This can be done quickly in Excel if you 
are working with say 4-5 years of 100 stocks but would be impractical 
for more)

4.  Import the manipulated file as a new symbol which now contains 
Date, Score (In Close), StockNum (In Volume) and Signal (In Open 
Interest)

5.  This new symbol then can be used to drive trades for each bar for 
each stock.

This works but is at best tedious and of course allows no 
optimization except on a hunt and peck basis.

How does ABTool improve this process and what other things have you 
done with this to insure that you are not more then 100% invested and 
to analyze the equity curve short of exporting the trade list and 
importing to Excel again ?

--- In amibroker@xxxxxxxxxxxxxxx, "Chuck Rademacher" 
<chuck_rademacher@x> wrote:
> You just can't wait, can you?
> 
> Other than using UM's ABTool, it is all in pure AFL code.   The 
next step is
> some jscript and then a DLL.   The learning curve is so steep and 
time is so
> short.  I guess I'm paying the price, at the moment, of using AFL 
code to
> prove that the concept works without regard to how long it takes to 
run.
> While it is running, I'm working on improving throughput.   Through 
all of
> this, I keep hoping that TJ is going to surprise us soon and/or 
David
> (TradeSim) will implement the changes I have requested, making my 
work
> redundant.
> 
> But your idea of how it works is "spot on".
>   -----Original Message-----
>   From: b519b [mailto:b519b@x...]
>   Sent: Sunday, May 04, 2003 2:01 AM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] Re: Ranking Stocks (AFL or via scripting)
> 
> 
>   Chuck,
> 
>   A generic version of your sorting system would be great to see.
> 
>   Is your sorting system entirely in AFL or does it use J script or 
VB
>   script or a custom DLL?
> 
>   My guess would be that it might involves a script which creates an
>   external file listing each ticker with an indicator value. The 
data
>   in the external file would next be sorted by an external program 
to
>   make a new ticker file that has the "cut off" value for the top 5,
>   10, 20 stocks in the Open, High, Low, etc fields. The Foreign
>   function could then be used to access these cut off values for the
>   actual backtesting. Of course, if you are using a DLL rather than 
a
>   script, the DLL might do the sorting itself and thus save a few
>   manual steps. This approach could be extended by using another J-
>   script to use the ranked external file to control which tickers 
get
>   traded for a particular day.
> 
>   Or have you found a way to do the sorting and record the results 
via
>   AFL. I can imagine an approach that might work in entirely in AFL
>   but it would involve the use of multiple artificial tickers and
>   would thus take "all day" to run.
> 
>   Am I any where close with either of these ideas?
> 
>   b
> 
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Chuck Rademacher"
>   <chuck_rademacher@x> wrote:
>   > I'm quite happy to share the methodology and code "snippets".
>   > Unfortunately, the actual AFL involved has too much of my
>   proprietary
>   > trading logic within it.   I'll have a look at replacing the
>   underlying
>   > system with something more generic.  Then, I would be able to 
post
>   the
>   > complete AFL.
>   >
>   > Once I've verified that it is working properly and it's not 
taking
>   all day
>   > to run, I'll prepare a document and post it in the files section
>   for this
>   > group.
>   >
>   > It wouldn't have been possible without the ABTool plug-in and
>   assistance so
>   > graciously contributed by UM.   I'm hoping that a few other
>   members of this
>   > group see the potential in UM's plug-in and come up with some
>   ideas of their
>   > own.   No doubt, there will be a better way than what I'm
>   currently doing.
>   > I call it "leap frog" technology.   Someone comes up with an 
idea
>   and
>   > someone else comes up with an improvement on that idea, etc. 
until
>   we all
>   > benefit from a group effort.
>   >
>   >
>   >   -----Original Message-----
>   >   From: HB [mailto:hossamb@x...]
>   >   Sent: Sunday, May 04, 2003 1:01 AM
>   >   To: amibroker@xxxxxxxxxxxxxxx
>   >   Subject: Re: [amibroker] Ranking Stocks (was ABTool)
>   >
>   >
>   >   Chuck, fascinating !
>   >
>   >   Once you rank, I assume that you can do things like:
>   >   - take the top "x" trades only
>   >   - take only the trades above a certain "y" value
>   >   - take only the trades that are "z"% below "q"'s value
>   >   - etc.
>   >
>   >   Yes ?
>   >
>   >   Will this ranking component be shared on the list ?
>   >
>   >   HB
>   >     ----- Original Message -----
>   >     From: Chuck Rademacher
>   >     To: amibroker@xxxxxxxxxxxxxxx
>   >     Sent: Sunday, May 04, 2003 0:40
>   >     Subject: RE: [amibroker] Ranking Stocks (was ABTool)
>   >
>   >
>   >     Ah ha.... I don't determine the ranking criteria.   More
>   explicitly, it
>   > can be whatever YOU like.
>   >
>   >     An example might help.   Let's say you thought that there 
was
>   > "information" in the RSI value; the lower the RSI value, the
>   better the buy
>   > signal.  If that was the case, your criteria would be the RSI
>   value and you
>   > could sort based on it.   If you had P/E or Debt/Equity ratio
>   available in
>   > your data, you could rank based on either of those.   The actual
>   buy signal
>   > can be something quite different from the ranking criteria.
>   >
>   >     In a nutshell, whatever YOU would like to rank by can be
>   written to a
>   > file and sorted in order to limit but orders to available cash.
>   >       -----Original Message-----
>   >       From: HB [mailto:hossamb@x...]
>   >       Sent: Sunday, May 04, 2003 12:12 AM
>   >       To: amibroker@xxxxxxxxxxxxxxx
>   >       Subject: Re: [amibroker] Ranking Stocks (was ABTool)
>   >
>   >
>   >       Chuck,
>   >
>   >       What are your ranking criteria ?
>   >
>   >       HB
>   >         ----- Original Message -----
>   >         From: Chuck Rademacher
>   >         To: amibroker@xxxxxxxxxxxxxxx
>   >         Sent: Saturday, May 03, 2003 23:12
>   >         Subject: RE: [amibroker] Ranking Stocks (was ABTool)
>   >
>   >
>   >         The ranking technique will work in optimize and backtest
>   mode.   It
>   > is slow, however, and that's what I'm workiing on now.
>   >           -----Original Message-----
>   >           From: b519b [mailto:b519b@x...]
>   >           Sent: Saturday, May 03, 2003 10:58 PM
>   >           To: amibroker@xxxxxxxxxxxxxxx
>   >           Subject: [amibroker] Ranking Stocks (was ABTool)
>   >
>   >
>   >           Chuck,
>   >
>   >           Does your ranking code just work in scan or 
exploration
>   modes, or
>   >           can it be using in backtesting to create portfolios of
>   limited
>   > size
>   >           (limited by number of stocks at one time, or limited 
by
>   total
>   >           capital used)?
>   >
>   >           b
>   >
>   >           --- In amibroker@xxxxxxxxxxxxxxx, "Chuck Rademacher"
>   >           <chuck_rademacher@x> wrote:
>   >           > I just finished modifying my "pairs"
>   >           trading AFL to use UM's new ABTool.
>   >           > It saves about 12 hours of processing
>   >           time, making it possible to actually
>   >           > use the system.
>   >           >
>   >           > I am almost finished modifying another
>   >           piece of AFL to rank buy/short orders
>   >           > and limit the orders to available cash.
>   >           >
>   >           > Since these two approaches don't seem
>   >           to be of general interest, I'm happy
>   >           > to discuss methods, etc. with anyone offline.
>   >           >
>   >           > Thanks again, UM, for developing such a useful tool.
>   >
>   >
>   >
>   >           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.
>   >
>   >
>   >
>   >         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.
>   >
>   >
>   >
>   >       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.
>   >
>   >
>   >
>   >     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
>   >
>   >
>   >
>   >   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
>               ADVERTISEMENT
> 
> 
> 
> 
>   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 ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/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/