Hi

Tomasz: Doing this is easy for the trading part; but I need to do it for the
backtesting part.  I need to be able to get the top-500 for* each day* in
the backtest.  This is where it is difficult!
Mike: I like your idea of backtesting the 8000 stocks then applying a code
to discard those that would not have existed.  But what would a custom
backtester code to do that would look like?

Thanks,

Louis

2008/7/15 Tomasz Janeczko <[EMAIL PROTECTED]>:

>    Hello,
>
> You don't need any extra coding for that.
> Use EXPLORATION, run it on the range "last 1 day" and all 8000 tickers.
> Use SetSortColumns to perform sorting (or click on column) and get top 500
> from the list.
> It is blazing fast, don't require any special coding.
> ======================================
> http://www.amibroker.com/video/exploration.html
>
> Note that if you are going to scan 8000 symbols *everyday* you would either
> need dedicated EOD source (may be even Yahoo) or if you insist on using
> intraday data
> way faster connection than your 256kbps intraday data is about 25KB per day
> per symbol
> (so about 200+ MB per 8000 symbols, so with your current connection it
> would take
> more than 4 hours fully saturated 256kbps connection)
> You really need to do the math. Your connection is tiny compared to what
> you are trying to
> do, and that means that you either need to adjust your methodology (usign
> EOD data for scans)
> or change the connection. There are physical limits of your setup that you
> seem to be ignoring.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
>
> ----- Original Message -----
> *From:* Louis Préfontaine <[EMAIL PROTECTED]>
> *To:* [email protected]
> *Sent:* Monday, July 14, 2008 11:39 PM
> *Subject:* Re: [amibroker] Re: Paul Ho: Memory Challenges with Great
> Ranking Tool
>
> I think you don't understand.  As I said like 10 times, this is the easiest
> part.  I need to find a code that will implement this in a backtest.  It is
> *easy* to create a watchlist every night and use that watchlist the next
> day in intraday.  What is more difficult is to have a code that will
> automatically rank the 8000 tickers *each day* and then use the 500 best
> as the universe of tickers to which the intraday code will be applied.
>
> 2008/7/14 <[EMAIL PROTECTED]>:
>
>>    Since you stated I described it accurately I don't think I need to
>> scroll up ...
>>
>> So as I said ... Create a watchlist with the top 500 ... I assume this
>> process only needs to be run once per day i.e. at end of day yesterday or
>> beginning of day today ... But in any case even if you run it every n
>> minutes it would still seem like the simplest way to get this done.
>>
>> After that you can use the Watchlist as the driving factor for whatever
>> else you are doing intraday
>>
>> ----- Original Message -----
>> From: Louis Préfontaine
>> Date: Monday, July 14, 2008 5:30 pm
>> Subject: Re: [amibroker] Re: Paul Ho: Memory Challenges with Great Ranking
>> Tool
>> To: [email protected]
>>
>> > Yes, this is exactly what I need. A code that will get the 500
>> > tradableseach day and add this as a condition for the intraday
>> > trading of the day
>> > after that. Just scroll up; all the details are there.
>> >
>> >
>> >
>> > 2008/7/14 :
>>
>> >
>> > > Scuse me ? ... I thought what you wanted was a list of the
>> > 500 tradables
>> > > that were closest to their 52 Week High as of today ... What
>> > did I miss ?
>> > >
>> > > ----- Original Message -----
>> > > From: Louis Préfontaine
>> > > Date: Monday, July 14, 2008 5:17 pm
>> > > Subject: Re: [amibroker] Re: Paul Ho: Memory Challenges with
>> > Great Ranking
>> > > Tool
>> > > To: [email protected]
>> > >
>> > > > This is not possible. I have to backtest each daily bar
>> > > > considering the top
>> > > > 500 has been chosen.
>> > > >
>> > > >
>> > > > 2008/7/14 :
>> > >
>> > > >
>> > > > > So create a watchlist with the top 500
>> > > > >
>> > > > > ----- Original Message -----
>> > > > > From: Louis Préfontaine
>> > > > > Date: Monday, July 14, 2008 4:56 pm
>> > > > > Subject: Re: [amibroker] Re: Paul Ho: Memory Challenges with
>> > > > Great Ranking
>> > > > > Tool
>> > > > > To: [email protected]
>> > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > > The problem I see using PositionScore is that PositionScore
>> > > > > > considers the
>> > > > > > number of signals in real-time to determine how many to
>> > consider> > > > when there
>> > > > > > are too many, but this is not possible for me because
>> > the goal
>> > > > > > is to limit
>> > > > > > the number of tickers from which to take the signals because
>> > > > > > with real-time
>> > > > > > data I can't process more than 500... Or maybe PositionScore
>> > > > > > can be used to
>> > > > > > get those 500 tickers in the first place?!
>> > > > > >
>> > > > > > Louis
>> > > > > >
>> > > > > > p.s. Glenn: I asked to be a member and will try to download
>> > > > > > osaka ASAP. I
>> > > > > > will get back to you with this. Thanks!
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > 2008/7/14 :
>> > > > >
>> > > > > >
>> > > > > > > Is there some reason that PositionScore doesn't work ? i.e.
>> > > > > > assuming> daily data then something to the effect of ...
>> > > > > > >
>> > > > > > > PositionScore = C / HHV(C, 252);
>> > > > > > >
>> > > > > > > The number of tradables can be limited in other ways ...
>> > > > > > >
>> > > > > > > ----- Original Message -----
>> > > > > > > From: Louis Préfontaine
>> > > > > > > Date: Monday, July 14, 2008 2:48 pm
>> > > > > > > Subject: Re: [amibroker] Re: Paul Ho: Memory
>> > Challenges with
>> > > > > > Great Ranking
>> > > > > > > Tool
>> > > > > > > To: [email protected]
>> > > > > > >
>> > > > > > > > Hi,
>> > > > > > > >
>> > > > > > > > Glenn: Do I have to be a member of amibroker-dll to
>> > get the
>> > > > > > OSAKA_105> > plugin? It sure seems like a nice
>> > feature... So,
>> > > > > > you believe it
>> > > > > > > > would do
>> > > > > > > > exactly what I need, I mean: it will select the 500
>> > > > stocks by
>> > > > > > > > ranking based
>> > > > > > > > on my conditions for EOD day 1 then apply my system for
>> > > > day 2,
>> > > > > > > > then do it
>> > > > > > > > again for EOD day 2 and apply the resulting 500 tickers
>> > > > to day
>> > > > > > > > 3, etc.?
>> > > > > > > > That would be awesome!
>> > > > > > > >
>> > > > > > > > Chris: This look like a good idea too, but what do you
>> > > > mean by
>> > > > > > > > whether it is
>> > > > > > > > on the list or not? I export all the results of the
>> > > > daily scan
>> > > > > > > > to a .csv
>> > > > > > > > with the EOD data for the best 500 tickers, then...
>> > > > what? It
>> > > > > > > > sure looks
>> > > > > > > > like a good idea if I can understand a little better how
>> > > > to do
>> > > > > > > > it. But do I
>> > > > > > > > have to do that for each day, and how to put the
>> > information> > > > > > back into AB?
>> > > > > > > > But so far your idea seems like the easiest to do, even
>> > > > if it
>> > > > > > > > would take
>> > > > > > > > forever for data going back to last year (but still,
>> > taking> > > > > > forever is
>> > > > > > > > better than losing all my money with an unsound strategy)
>> > > > > > > >
>> > > > > > > > Ken: " *Are you saying that you want to BACKTEST
>> > 8000 symbols
>> > > > > > > > and "select",
>> > > > > > > > based on profitability, the top 500 most profitable ones
>> > > > to use
>> > > > > > > > in your next
>> > > > > > > > day's trading.*" No; I want to select the 500 tickers
>> > > > which are
>> > > > > > > > closest to
>> > > > > > > > their 52 weeks HHV and use those tickers for
>> > intraday trading
>> > > > > > > > the next day.
>> > > > > > > > It is easy to do in live trading, but I need to find a
>> > > > way to
>> > > > > > > > include it in
>> > > > > > > > backtesting so when I test my strategy I am not
>> > using 8000
>> > > > > > > > tickers but
>> > > > > > > > "only" the 500 closest to HHV based on their
>> > daily(yesterday)> > > > > > EOD close.
>> > > > > > > >
>> > > > > > > > Thanks all for your help. I really feel like this is going
>> > > > > > somewhere!> >
>> > > > > > > > Louis
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > 2008/7/13 glennokb :
>> > > > > > >
>> > > > > > > >
>> > > > > > > > > If I understand what you are trying to do, maybe
>> > this method
>> > > > > > > > - Osaka!
>> > > > > > > > >
>> > > > > > > > > It creates a composite which you can reference in your
>> > > > > > system for
>> > > > > > > > > backtesting
>> > > > > > > > >
>> > > > > > > > > Note that the 500 may not be precise due to data
>> > holes (as
>> > > > > > Graham> > > mentioned). Plus I just added HHV(H,100) as an
>> > > > > > example but
>> > > > > > > > this need
>> > > > > > > > > to be replaced with your rank.
>> > > > > > > > >
>> > > > > > > > > Also, check the categoryGroup or Watchlist is
>> > correct in
>> > > > > > the code.
>> > > > > > > > >
>> > > > > > > > > // Add To Composite RankValue based on Ranking
>> > calculation.> > > > > > > /*------------------------
>> > > > > > > > > Notes:
>> > > > > > > > > 1. Install OSAKA_105.zip ranking located here:
>> > > > > > > > > http://groups.yahoo.com/group/amibroker-dll/
>> > > > > > > > > 2. Use CURRENT SYMBOL - an index
>> > > > > > > > > (ie: symbol with no data holes).
>> > > > > > > > > 3. Select date range
>> > > > > > > > > 4. SCAN
>> > > > > > > > > --------------------------*/
>> > > > > > > > >
>> > > > > > > > > osInitialize();
>> > > > > > > > > #pragma nocache
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // User Variables - enter here
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > sGroup = 0; // set to desired watchlist.
>> > > > > > > > > Rank_No = 500; // set the depth to rank to.
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // USER variables - Used for consistency & Ease
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > sov1 = 100;
>> > > > > > > > > sov2 = 0; // not currently used
>> > > > > > > > > sov3 = 0; // not currently used
>> > > > > > > > > sov4 = 0; // not currently used
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // AddToComposite name
>> > > > > > > > > // ----------------------------------
>> > > > > > > > >
>> > > > > > > > > ATCName = "~HHV_Rank";
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // Ranking Calculation
>> > > > > > > > > // ----------------------------------
>> > > > > > > > >
>> > > > > > > > > function Ranking(Sov1,Sov2,Sov3,Sov4)
>> > > > > > > > > {
>> > > > > > > > >
>> > > > > > > > > TO = HHV(H,Sov1);
>> > > > > > > > >
>> > > > > > > > > return TO;
>> > > > > > > > > }
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // End Ranking Calculation
>> > > > > > > > > // ----------------------------------
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // End User Variables
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > StartBar = LastValue( ValueWhen(
>> > Status("firstbarinrange"),> > > > > > > BarIndex() ) );
>> > > > > > > > > FinishBar = LastValue( ValueWhen(
>> > Status("lastbarinrange"),> > > > > > > BarIndex() ) );
>> > > > > > > > > RankValue = 0; // initialise Rank Value array
>> > > > > > > > > List = GetCategorySymbols( categoryGroup, sGroup);
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // Create Ranking Table
>> > > > > > > > > // ----------------------------------
>> > > > > > > > >
>> > > > > > > > > sRank = osTabCreate();
>> > > > > > > > > // Initialize Ranking Columns
>> > > > > > > > > // Use loop to add columns to cover # of bars ranked.
>> > > > > > > > > i = StartBar;
>> > > > > > > > > while (i <= FinishBar)
>> > > > > > > > > {
>> > > > > > > > > osTabAddColumn("RROR", 1, sRank);
>> > > > > > > > > i = i + 1;
>> > > > > > > > > }
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // Load table with Ranking data
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > for (j=0; (sTicker = StrExtract( List,j)) != ""; j++)
>> > > > > > > > > {
>> > > > > > > > > SetForeign(sTicker);
>> > > > > > > > > Rank = Ranking(Sov1,Sov2,Sov3,Sov4);
>> > > > > > > > > k = StartBar;
>> > > > > > > > > i = 0;
>> > > > > > > > > while (k <= Finishbar)
>> > > > > > > > > {
>> > > > > > > > > osTabSetNumber(Rank[k], j, i, sRank);
>> > > > > > > > > i = i + 1;
>> > > > > > > > > k = k + 1;
>> > > > > > > > > }
>> > > > > > > > > RestorePriceArrays();
>> > > > > > > > > }
>> > > > > > > > >
>> > > > > > > > > // ----------------------------------
>> > > > > > > > > // Sorting rank calculations
>> > > > > > > > > // ----------------------------------
>> > > > > > > > >
>> > > > > > > > > k = StartBar;
>> > > > > > > > > i = 0;
>> > > > > > > > > while (k <= Finishbar)
>> > > > > > > > > {
>> > > > > > > > > osTabSort(sRank, i, False, True);
>> > > > > > > > > RankValue[k] = osTabGet(Rank_No-1, i, sRank);
>> > > > > > > > > i = i + 1;
>> > > > > > > > > k = k + 1;
>> > > > > > > > > }
>> > > > > > > > >
>> > > > > > > > > // ---------------------------------------
>> > > > > > > > > // clean up - delete srank table
>> > > > > > > > > // ---------------------------------------
>> > > > > > > > > osTabDelete(srank);
>> > > > > > > > >
>> > > > > > > > > AddToComposite(rankvalue, ATCName, "x",23);
>> > > > > > > > >
>> > > > > > > > > Buy=Sell=1;
>> > > > > > > > > Filter=1;
>> > > > > > > > > AddColumn(RankValue, "Rank value",1.0);
>> > > > > > > > > //END
>> > > > > > > > > // ---------------------------------------
>> > > > > > > > >
>> > > > > > > > > Then place this code in your system for backtesting:
>> > > > > > > > >
>> > > > > > > > > HHV_Symbol = Foreign("~HHV_Rank","C");
>> > > > > > > > > HHV_Rank = HHV(H,100) > HHV_Symbol;
>> > > > > > > > >
>> > > > > > > > > Buy = HHV_Rank and cond1 and cond2 etc
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > >
>> > >
>> > >
>> >
>>
>
>  
>

Reply via email to