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

Re: [amibroker] add scan results to wathlist programmatically



PureBytes Links

Trading Reference Links

Hi Dave,
 
I'm joining the party late, so apologies if this has already been suggested and tried or if this isn't close to what you're looking for -- of late I've had no time to keep up with reading the group or do any AB work.  This is something I believe I got the basics of from Dan, adapted long ago and perhaps there are newer and better ways to do, but it works for my watchlists.  Via the parameters, you may clear, replace or add to a watchlist which you can select by number.  The default is to not clear, and if clearing then to refill. 
 
As I use it, in other explorations, it allows me to manage watchlists daily and weekly -- altho I've not had time to do much in explorations and have been existing on a diet of daily trades in stocks I know well and which have good % moves daily.  This is a trimmed down version of the output, but one can add ATR, Avg Range, RSI, ADX and a host of other columns to help refine the information.  The multiple column sort now makes this a very viable way for me to ID trading candidates.
 
AA Code is below and attached.  Enjoy. 
 
Peace and Justice   ---   Patrick
 

// Basic Watchlist Management

// Code to clear a watchlist, repopulate that watchlist or add exploration results to an existing watchlist

w = Param("Empty Watchlist First? Yes = 1, No = 2" , 2, 1, 2, 1);

w1 = Param("Autofill Watchlist? Yes = 1, No = 2" , 1, 1, 2, 1);

x = Param ( "Add Results to an Existing Watchlist? Yes = 1, No = 2" , 2 , 1 , 2 , 1 ) ; // select whether to add results to watchlist or not

y = Param("Set Watchlist Number", 2, 2, 60,1); // sets the watchlist number, but reserves the first 2 and last 4 watchlists

Clear = IIf(w ==1, x==2, 0); if( LastValue(Clear) ) {CategoryRemoveSymbol("", categoryWatchlist, y); }

// -------- Parameter Variables for Exploration --------------------------------

TCH = Param("High close value ", 20, 5, 300, 0.5);

TCL = Param("Low close value " , 5, 1, 10, 0.25);

AVP = Param("Period for Avg Vol " , 21, 5, 240, 1);

SV = Param("Stock minimum Avg Vol " , 125000, 50000, 1000000, 5000);

My_Conditions = Close >= tcl AND Close <= tch AND MA( Volume, avp ) > sv;

Filter = My_Conditions;

Buy = Filter;

autoFILL = IIf( w1==1, Filter,0 ) ;

Add = IIf( x==1, Filter , 0 ) ;

if( LastValue( Add OR autoFill ) )

{ CategoryAddSymbol( "", categoryWatchlist, y ); }

 

// -------------- Organize the exploration results ------------------------------------

AddTextColumn(IndustryID(1) ," Industry Sector ", 25.0, colorWhite, colorBlue);

AddColumn(C, "Close", 2.2, colorDarkGreen, colorLightGrey);

AddColumn(V, "VOLUME",8.0, colorYellow, colorDarkGreen);

AddColumn( MA(V,AVP) , WriteVal(AVP,3.0)+ " Bar Avg VOL", 8.0, colorWhite, colorBlue);

AddColumn( (V/Ref(MA(V,21),-1))*100,"V % of "+ WriteVal(AVP,3.0) +" dMA" ,3.0, colorLightYellow, colorDarkGrey);

 
 
 
----- Original Message -----
Sent: Sunday, March 26, 2006 12:53 PM
Subject: RE: [amibroker] add scan results to wathlist programmatically

Hi Dan,

 

Is there a difference?   My preference is to put it into all of my exploration code.

 

This is the beginning part (snippet) of most of my explorations:

 

//  --------  Parameter Conditions and Variables for Exploration

 

WLF = ParamToggle ( "Add Results to a Watchlist?", "No|Yes") ; 

 

// WLF – flag to select whether to add results to watchlist or not

 

WLN = Param("Set Watchlist Number", 2, 2, 60,1);

 

// WLN - sets the watchlist number, but reserves the first 2 and last 4 watchlists

 

 

(I am using line returns to force formatting in this email)

 

What I would like to implement is the clearing of the watchlist should I set my WLF to true or Yes. If I am to copy the results of this scan to my watchlist then I am going to want to clear it first.  The WLF will be true and the WLN will have the watchlist # that I am going to use with this exploration.  In the future I am most likely going to hard code the watchlist # for each exploration.  This will make it easier to run batch processing via Batman or scripts (way beyond my skill level at the moment though).

 

MM

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Dan Clark
Sent: Sunday, March 26, 2006 6:32 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] add scan results to wathlist programmatically

 

Jeff,

 

Are you going to run this in a scan or exploration?

 

Regards,

 

Dan.

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of hongyu lu
Sent: Saturday, March 25, 2006 10:45 PM
To: amibroker@xxxxxxxxxxxxxxx
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@xxxxxxxxxxxxx> 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

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@xxxxxxxxxxxxx> 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

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

 

 


 



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

 

 







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




Attachment: Description: Binary data