[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Simple code stumper



PureBytes Links

Trading Reference Links

Bill,

 

I don’t think that will work.  I tried something similar.   Try this:

 

/*

** Filter by Master List in AA Window

*/

 

//Remove current symbol from target Watchlist. 

//This ensures that <TargetWatchlist> is always clean.

CategoryRemoveSymbol("", categoryWatchlist, 1);  

CategoryRemoveSymbol("", categoryWatchlist, 2);  

CategoryRemoveSymbol("", categoryWatchlist, 3);  

CategoryRemoveSymbol("", categoryWatchlist, 4);  

CategoryRemoveSymbol("", categoryWatchlist, 5);  

CategoryRemoveSymbol("", categoryWatchlist, 6);  

CategoryRemoveSymbol("", categoryWatchlist, 7);  

CategoryRemoveSymbol("", categoryWatchlist, 8);  

 

Ensure that the AA filtering is such that your scan will include all symbols that could possibly be in any of your target Watchlists.   What happens is that, as each symbol is scanned, it is removed from each of the target Watchlists. 

 

This should run pretty fast.  It turns out that retrieving symbols is the slow part.  Once a symbol is retrieved and current, it will process pretty fast.  You should see little difference in removing a symbol from one Watchlist or eight Watchlists.

 

Regards,

 

Dan.

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of wavemechanic
Sent: Sunday, August 14, 2005 7:54 PM
To: AmiBroker, User
Subject: Re: [amibroker] Simple code stumper

 

Dan:

 

Thanks.  I believe I see what you are doing and may have to go that route (kicking and screaming!).

 

What I am doing (and would like to continue doing) is simply using the settings in AA to define a group that acts as the filter for the ALL section.  My results are automatically sent to 8 watchlists and the CategoryAddSymbol() used to do this writes to the watchlists, but it does it in append mode.

 

I have used the following code that is similar to yours (I think) at the beginning of the program to cleanout the watchlist before writing the symbol results.  Unfortunately it does not work right and I don't know why.  It properly deletes old symbols but then does not allow results (except one) to be written to the watchlist.

 

All that is needed is a switch for CategoryAddSymbol() that permits overwriting rather than appending.  Hopefully, this is being considered for a future release.  As a friend from Ukraine says "Why simple if complex will work just as well." ;-)

 

Bill

==========================

 

for(i = 0; i < 8; i++)

{

list = CategoryGetSymbols(categoryWatchlist, i);

for(j = 0; (symbol = StrExtract(list, j)) != ""; j++)

{

    CategoryRemoveSymbol(symbol, categoryWatchlist, i);

}

}

----- Original Message -----

From: Dan Clark

Sent: Sunday, August 14, 2005 7:55 PM

Subject: RE: [amibroker] Simple code stumper

 

Bill,

 

I think I had the same issue a few days ago.  Tomasz suggested adding “CategoryRemoveSymbol()” to my code, but it is the flow of code that makes it work…

 

You use two source Watchlists. The first is a “Master” list of all the symbols you would trade.  (In my case, I call this “Tradable Symbols”.)  The second is one of several “Source” Watchlists.     

 

You always use the “Master” Watchlist as the Exploration filter.   Because you are always running through your Master, all symbols will be removed from the target Watchlist just prior to processing that symbol.

 

Your “Source” Watchlist is used by the “InWatchList” function.  If “InWatchList” is True, then process the symbol.  For example:

 

/*

** Filter by Master List in AA Window

*/

 

//Remove current symbol from target Watchlist. 

//This ensures that <TargetWatchlists> is always clean.

CategoryRemoveSymbol("", categoryWatchlist, <TargetWatchlist>);  

 

//Use InWatchlist to check for symbol in Source List

ValidSymbol = InWatchList ("", categoryWatchlist, <TargetWatchlist>);  

 

If (ValidSymbol)

  {

  // Your processing code here

  }

 

I think it would be a more elegant solution to be able to clean out the target Watchlist, but this works well.  I hope it works for you.

 

Regards,

 

Dan.




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS