Hi Dingo, with the code which I posted, a symbol should be added to the watchlist EXACTLY when the Filter criteria is fulfilled (only if Filter == True then a symbol is added to AAs result list!). LastValue(Cum(Filter)) is exactly testing for Filter == True (means at least for one bar the Filter array is set to True => criteria met). From my understanding Watchlist and AA should be same, but they are not ... CategoryRemoveSymbol works fine, but I also tested with an empty watchlist and got the same problem. Regards, Markus
_____ Von: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von dingo Gesendet: Sonntag, 3. Juni 2007 22:27 An: amibroker@yahoogroups.com Betreff: RE: [amibroker] Why is my AA result and watchlist different after Explore? Ok then, To be on the AA result list all it has to do is pass the filter test but you're using another test (lastvalue(cum(filter to add to the watchlist. Try making them the exact same. Seems to me that's where the diff is.. Also make sure the CategoryRemoveSymbol("", categoryWatchlist, DestinationWatchlist); is working as expected. d _____ From: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Markus Hoffmann Sent: Sunday, June 03, 2007 4:21 PM To: amibroker@yahoogroups.com Subject: AW: [amibroker] Why is my AA result and watchlist different after Explore? I think my problem is not related to the for-loop. In the meanwhile I replaxed it by: Filter = (AveTurnover > LowerTurnoverLimit) AND (AveClose > LowerStockPriceLimit); if(LastValue(Cum(Filter))) { CategoryAddSymbol( "", categoryWatchlist, DestinationWatchlist ); } The effect is still the same, the watchlist contains more symbols than AA result list. _____ Von: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von dingo Gesendet: Sonntag, 3. Juni 2007 22:16 An: amibroker@yahoogroups.com Betreff: RE: [amibroker] Why is my AA result and watchlist different after Explore? The question you should be asking yourself is "why did I choose to use a 'for loop'" .. d _____ From: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Markus Hoffmann Sent: Sunday, June 03, 2007 2:29 PM To: amibroker@yahoogroups.com Subject: [amibroker] Why is my AA result and watchlist different after Explore? 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