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 <[EMAIL PROTECTED]>:

>   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