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

Re: [amibroker] Simple code stumper



PureBytes Links

Trading Reference Links

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





YAHOO! GROUPS LINKS