Mark,

As mentioned in my earlier post, PositionScore alone is not enough for you 
because you are using *conditional* entries. You require custom backtesting 
code.

The way it traditionally works is that a strategy looks for a setup based upon 
some set of rules, then enters a position when that setup occurs.

e.g.
Setup = ...;
Buy = Setup;

In which case every Setup is a Buy (they are equivalent) and the backtester can 
blindly rely upon PositionScore of the Buys to sort and enter based upon 
maximum allowable positions.

In your case, you are looking for a setup based upon some set of rules, then 
*conditionally* entering a position when that setup occurs.

e.g.
Setup = ...;
Buy = Setup AND SomeCondition;

In other words, Setup and Buy are no longer equivalent. Yet, you are wanting 
the backtester to sort based on the symbols found in Setup instead of Buy 
(which is now a subset of Setup).

The result is that some of the top 10 symbols from Setup do not satisfy the 
more strict criteria of Buy, thus the top 10 Buy will include symbols that 
would have been lower in the rankings when considering all of Setup (e.g. 
position 12 in Setup might map to position 8 in Buy when multiple symbols of 
Setup did not meet the additional SomeCondition of Buy).

There are two ways to work around this:

1. Keep external lists of the top 10 Setup PositionScore and write custom 
backtest code to ignore Buy signals that have a PositionScore less than the 
lowest of the 10 Setup PositionScores. This works and allows you to keep your 
strategy logic unchanged. But, it is *very* slow when run on the universe of 
all stocks:

http://finance.groups.yahoo.com/group/amibroker/message/114739

2. Change your strategy logic to move the additional SomeCondition out of the 
main code and into the custom backtester instead. This is much faster, at the 
cost of losing strategy clarity. Ultimately, the better path if you plan to do 
any kind of optimization.

http://finance.groups.yahoo.com/group/amibroker/message/114784

Mike

--- In [email protected], "mbluhm2001" <mbluhm2...@...> wrote:
>
> Mike,
> 
> Thanks for the reply. The way "I think" it works is that it will take the 100 
> stocks, for example that met the entry criteria, and sort them by the top 
> HV100. It will then take the 1st 10 stocks that triggered a buy signal no 
> matter how far into the list of 100.  
> 
> So what I want is to limit the triggered stocks to only the top 10 HV100 
> stocks and not the whole list.  
> 
> Hope that makes sense. 
> 
> Thanks for your response,
> Mark
> 
> 
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > Hi,
> > 
> > If I understand you correctly, there should be no need to have a second 
> > filter. Just set PositionScore to HV100 and max positions to 10. The 
> > backtester will automatically sort by PositionScore and take the highest 
> > ranking signals up to and including max positions.
> > 
> > However, the above only applies for absolute entries. If your entries are 
> > conditional entries (i.e. limit orders), then you have to do some special 
> > handling and custom backtesting code.
> > 
> > Mike
> > 
> > --- In [email protected], "mbluhm2001" <mbluhm2001@> wrote:
> > >
> > > I'm back testing the whole universe of stocks and i have a filter 
> > > criteria to reduce that down to possible candidates. Some days i get 5 
> > > stocks other days i might get 100 stocks. If i have more than 10 stocks I 
> > > want to only take the 10 stocks that have the highest HV100. This is easy 
> > > to see each day when i scan but I want to back test this and this is the 
> > > problem. Effectively i'm using a filter that gets me the initial list of 
> > > stocks and then i want to take that list, scan it and then take the top 
> > > 10 HV100 stocks. 
> > > 
> > > Just to repeat this another way, the question is how can i effectively 
> > > use a 2nd filter (and the min value for this filter isn't know until 
> > > after i have the list of possible stocks to trade for that day) to reduce 
> > > list to max 10.
> > > 
> > > Thanks,
> > > Mark
> > >
> >
>


Reply via email to