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