Hi
all,
I
have some strange behaviour with the Explore function and could not yet find
out
the
reason, maybe somebody has an idea?
I
want to run an exploration over a symbol list (I did it with S&P500 and
Prime All Share),
and
the filtered symbols should be stored in a watchlist. In the AA I specified
for "Range"
to
check the "n last quotes" with n=1, therefore AA result is max. 1 hit per
symbol. The
interesting thing is that the results which
are listed in the AA dialog and the contents of
my
watchlist is different, my resulting watchlist has always some more
symbols included
than
the AA result list (which is correct, and the additional
watchlist symbols do in fact not
fulfill the filter criteria of LowerStockPriceLimit).
I used the code below:
---
cut here ---
// filter rule:
//
position size must not be larger than 3% of the average trade volume
//
within the last 5 days and average stock price must be larger than 1$
//
example:
// portfolio equity = 100000$
// position size = 5% => 0.05
* 100000$ = 5000$
// minimum trade volume = 5000$ / 0.03 =
166667$
PositionSize = 5000;
PositionSizeToTurnoverRatio =
0.03;
LowerStockPriceLimit = 100;
// set here the watchlist
number to store the results
DestinationWatchlist = 1;
// remove symbol from
watchlist (clean up from previous run)
CategoryRemoveSymbol("", categoryWatchlist,
DestinationWatchlist);
LowerTurnoverLimit =
PositionSize / PositionSizeToTurnoverRatio ;
AveVolume = MA(Volume,
5);
AveClose = MA(Close,
5);
AveTurnover = AveVolume *
AveClose;
Filter = (AveTurnover >
LowerTurnoverLimit) AND (AveClose >
LowerStockPriceLimit);
AddColumn(Close,
"Close");
AddColumn(Volume,
"Volume");
AddColumn(AveVolume,
"Ø Volume");
AddColumn(AveTurnover,
"Ø Turnover");
for(i=0;
i<BarCount;i++)
{
if(Filter[i] ==
True)
//
if((AveTurnover[i] > LowerTurnoverLimit) AND (AveClose[i] >
LowerStockPriceLimit))
{
CategoryAddSymbol( "",
categoryWatchlist, DestinationWatchlist );
}
}
---
cut here ---
I
tried both if-statements to check if the criteria to add the symbol to
watchlist is ok, both
show
the same effect. No idea if maybe my code is wrong or AB behaviour is wrong
...
Thanks in advance for your help and best regards,
Markus