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

Re: [amibroker] Re: add scan results to watchlist programmatically



PureBytes Links

Trading Reference Links

 I just clipped this out of a formula that works and based on an example that Tomasz wrote and is in the help documentation.

  I don't why it doesn't work...Could be you're missing the Return statement from the function. 

Run this as a SCAN, select Refresh All to see your WL No. evaporate. Make sure it's the one you want to get rid of.'

Best regards

JOE

function ClearWatchlist( listnum )

{

// retrieve comma-separated list of symbols in watch list

list = CategoryGetSymbols( categoryWatchlist, listnum );

for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )

{

CategoryRemoveSymbol(sym,categoryWatchlist,Listnum);

}

return;

}Buy=Sell=1;

Clearwatchlist(1);

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

Sent: Sunday, March 26, 2006 8:57 AM
Subject: [amibroker] Re: add scan results to watchlist programmatically

Hi folks,

I can't seem to get this to work.  Here is my code:

// Exploration code to clear a watchlist

function ClearWatchList(_watchListNumber)
{_toClear = CategoryGetSymbols(categoryWatchlist, _watchListNumber);
    for(i = 0; (symC = StrExtract(_toClear, i) ) != ""; i++)
       {CategoryRemoveSymbol(symC, categoryWatchlist, _watchListNumber);}
}

ClearWatchList(4);

Filter=True;


I read in the help files that the "GetCatagorySymbols" was changed to
"CatagoryGetSymbols" and so I am using that Function.

It is probably something simple.

I am trying to run the code above as a simple exploration to clear out
a single watchlist.  The loop code below will be next.  Then I am
thinking of using the #include function to add it to a number of my
explorations.  My thinking is that this small piece of code will be
easier to manage from one file than if I copy and paste into all of my
explorations.

MM

--- In amibroker@xxxxxxxxxxxxxxx, "Joe Landry" <jelandry@xxx> wrote:
>
> Hello Jeff -  I like the way you've coded this!  Obviously you had
some experience. I'm clipping this and putting
> it in the bottomless pit of code snippets that I use to augment my
memory and lack of training
>  
> You can tell I got started many years before where we could not
carry around long symbol names.  This way is self
> documenting. Always easier to read. 
>
> NOW for finding what ConditonA and ConditionB are?   The HOLY GRAIL?
>
> BTW if you scan this forum for recent postings by Dan Clark, and I'm
sure others you'll find Dan's developed daily runs where he
> builds multiple watchlists of sectors or industry areas.  I do these
runs on a daily basis for the 12 sectors in QuotesPlus then build
> composites of the breadth metrics of these sectors.  In starting
this out I have to clear 12 watchlists and one could use your function
within a FOR loop.
>
> for (i=30;  i<=41;  i++)
> {
> Clearwatchlist(i);
> }
>
> I'll have to be careful in making sure the ranges are accurate
otherwise I'll clear out more than I expect.   Coding a utility
> to write specific watchlists to CSV files wouldn't be a bad idea,
either. 
>
> Best regards
> Joe 

>   ----- Original Message -----
>   From: hongyu lu
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: Sunday, March 26, 2006 12:44 AM
>   Subject: Re: [amibroker] add scan results to wathlist programmatically
>
>
>   thanks for all the info to get it work. here is the summary for
reference.
>
>   1. To clear watchlists:
>
>   function ClearWatchList(_watchListNumber) {
>       _toClear = GetCategorySymbols(categoryWatchlist,
>                                                               
_watchListNumber);
>       for(i = 0; (symC = StrExtract(_toClear, i) ) != ""; i++) {
>           CategoryRemoveSymbol(symC, categoryWatchlist,
>                                                      
_watchListNumber);
>       }
>   }
>
>   ClearWatchList(0);
>   ClearWatchList(1);
>   ClearWatchList(2);
>   ClearWatchList(3);
>
>   2. To add scanned out stocks to watchlists:
>
>   r2 = ConditionA and ConditionB;   
>
>   if (LastValue(r2) == 1) {
>       CategoryAddSymbol("", categoryWatchlist, 1);
>   }
>
>   Buy = 0;
>
>   Thanks again!
>   Jeff
>
>
>
>   On 3/25/06, Joe Landry < jelandry@xxx> wrote:
>     Here's another example.  When you go to see if you've been
successful be sure to select refresh all
>
>     // clear Watchlists used to store composite symbols of QP Sector
Runs
>
>     WL =
>
>     3;  // or use WL = Param("WL No.",3,1,63,1);
>     ClearList =
>
>     GetCategorySymbols(categoryWatchlist, WL);
>
>     for( i = 0; ( symC = StrExtract(ClearList, i) ) != ""; i++ )
>     {
>
>
>     CategoryRemoveSymbol( symC, categoryWatchlist, WL );
>     }
>
>
>     Buy = Sell =0;
>     ----- Original Message -----
>     From: hongyu lu
>     To: amibroker@xxxxxxxxxxxxxxx
>     Sent: Saturday, March 25, 2006 2:19 PM
>     Subject: Re: [amibroker] add scan results to wathlist
programmatically
>
>
>     Hi Joe,
>
>     could you give an example? I played with my afl but could not
figure out how to get the scanned out symbols.
>
>     if my buy signal is like below, how to add the scanned out 'buy'
symbols to watch list?
>
>     buy = a & b & c;
>
>     i tried: CategoryAddSymbol(Name(), categoryWatchlist, 10); but
got all db symbols added.
>     i also tried: valuewhen(buy, name()), but got syntax error.
>
>     could you shed some lite on this?
>
>     thanks a lot
>     Jeff
>
>
>     
>     On 3/25/06, Joe Landry <jelandry@xxx> wrote:
>       There's a function called categoryaddsymbol...can be used to
add your selected ticker to a watchlist to
>       build watchlists.  You can also clear your watchlist
programmatically.
>       Best regards
>       JOE 
>         ----- Original Message -----
>         From: hongyu lu
>         To: amibroker@xxxxxxxxxxxxxxx
>         Sent: Saturday, March 25, 2006 1:04 AM
>         Subject: [amibroker] add scan results to wathlist
programmatically
>
>         
>         is it possible to add scan results to wathlist with AFL
programmatically? I have to do "add all results to watch list" all the
time at this point.
>
>         thanks in advance
>         Jeff
>
>
>
>       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  Real estate
investment software  Investment property software 
>             Software support  Real estate investment analysis
software  Investment software 
>
>
>
--------------------------------------------------------------------------
>       YAHOO! GROUPS LINKS
>
>         a..  Visit your group "amibroker" on the web.
>          
>         b..  To unsubscribe from this group, send an email to:
>          amibroker-unsubscribe@xxxxxxxxxxxxxxx
>          
>         c..  Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.
>
>
>
--------------------------------------------------------------------------
>
>
>
>
>
>     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  Real estate
investment software  Investment property software 
>           Software support  Real estate investment analysis software
Investment software 
>
>
>
----------------------------------------------------------------------------
>     YAHOO! GROUPS LINKS
>
>       a..  Visit your group "amibroker" on the web.
>        
>       b..  To unsubscribe from this group, send an email to:
>         amibroker-unsubscribe@xxxxxxxxxxxxxxx
>        
>       c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service .
>
>
>
----------------------------------------------------------------------------
>
>
>
>
>   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
>
>     a..  Visit your group "amibroker" on the web.
>      
>     b..  To unsubscribe from this group, send an email to:
>      amibroker-unsubscribe@xxxxxxxxxxxxxxx
>      
>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
------------------------------------------------------------------------------
>







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