One correction:
Add the following line to the JScript:
AB.Stocks.Add("~VALUES");
before:
values = AB.Stocks("~VALUES");

I didn't catch it because I alreasy have ticker "~VALUES" in my database.
 
----- Original Message -----
From: Mark H
Sent: Friday, September 15, 2006 11:55 PM
Subject: Re: [amibroker] Loading Symbols via AFL--was: I need a little help with an ATC

Ken:
 
I have spent some time to do my own exercise and implement the JScript and AFL as I proposed.
They are attached and have also been posted to the online library at:
I have tested them and they seem to be working as expected.
 
- Mark H.
 
----- Original Message -----
From: Mark H
Sent: Friday, September 15, 2006 2:12 PM
Subject: Re: [amibroker] Loading Symbols via AFL--was: I need a little help with an ATC

Ken:
 
This can be done by combining JScript (or _vbscript_) with AFL. It would be difficult to do it by AFL alone unless you want to involve a lot of manual steps or make the AFL code really complex.
In the JScript:
Loop through all tls files:
    (1) Invoke an AFL1 to do a) and b) to create the watchlist
    (2) Invoke an AFL2 to do c) to calculate the composite
    (3) Invoke an AFL3 to do d) to assign the composite to a watchlist
AFL1:
    Empty the watchlist and read file and fill the watchlist.
AFL2:
    AddToComposite()
AFL3:
    Set watchlist category for the composite.
(You can combine AFL1,AFL2,AFL3 into one AFL file, but use Scan, Explore and some switches to let different parts run at different invocations.)
 
This is an excellent use case of interaction between JScript and AFL. In step (1), the tls file name needs to be passed to the AFL. (use StaticVarSetText would be really simple :-)) In step (3), a switch variable can be passed to the AFL and let it run a different part of the Exploration code.
 
My estimates are the JScript would be 40 line of code and the combined AFL would be 50 line of code.
 
- Mark H.
 
----- Original Message -----
From: Ken Close
Sent: Friday, September 15, 2006 9:37 AM
Subject: [amibroker] Loading Symbols via AFL--was: I need a little help with an ATC

Joe: thanks for this detail. I have been searching and capturing published
code around these very issues, but had not seen the messages from NW Trader.

I am still on my quest to a) empty a watchlist; b) load a tls of symbols
programmatically; c) calculate an ATC average on this newly loaded list of
symbols, and d) save the ATC to another watchlist.

This speaks to my objective to produce ATCs of all the major ETFs (from
their holdings), which exceed the number of Watchlists available. If I can
accomplish the above steps, then Watchlist number should not be a
limitation.

Can you or anyone give me an example of how to load a tls or txt file of
symbols programmatically and then perform an ATC on them.

I asked this several weeks ago, got no replies, and did not press for help
because of other tasks at the time. I really would like some help on the
step b) above as I think I can accomplish the other steps from all of the
code snippits I have gathered.

Please help.

Thanks,

Ken

-----Original Message-----
From: [EMAIL PROTECTED]ps.com [mailto:[EMAIL PROTECTED]ps.com] On Behalf
Of Joe Landry
Sent: Friday, September 15, 2006 6:56 AM
To: [EMAIL PROTECTED]ps.com
Subject: Re: [amibroker] I need a little help with an ATC

Don - The routines from a thread dating March of 2006 may help you to
Clear, Repopulate, and Add Exploration issues to watchlist. There are
several contributions to that thread ending with the one by Patrick. Other
contributors in the area have also been Dan Clark, Jeff, Steve Dugas. I'm
not in the Yahoo file so I don't know the message numbers. Search on
NWTrader or Dan Clark.

In some of the writing I just found I noted some folks start with their
"universe" of stocks numbering 8000 -10,000 or All Issues. As the TC2000

Worden Bros. folks have taught, you're probably be better to start with a
list of stocks that are tradeable( your definition) with criteria like
closing price and traded volume. Here's my range >$5, > $10 or
>$15.....Volume > 50K, >100K or >200K. This will reduce the number of
stocks that have to be loaded into your internal database (the 1st time
through) to 1/3 and screened. I start with this daily from QP with the
criteria => 1) Is stock?, 2)Price > 5 and 3)Volume > 50K and work with a
"universe" of just over 3500. You can do this programmatically with AB as
the first
job step.

Thanks for the recent posting to the Yahoo files. Another place you can
post is in the AFL Library.

HTH
Joe L.

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 ORautoFill ) )

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

----- Original Message -----
From: "Don Lindberg" <[EMAIL PROTECTED]net>
To: <[EMAIL PROTECTED]ps.com>
Sent: Friday, September 15, 2006 2:33 AM
Subject: [amibroker] I need a little help with an ATC

> Group.
>
> I have created several ATC's to build composite indexes of some of
> my WatchList. Here is the code I used.
>
> /* AddToComposite statements are for Automatic Analysis -> Scan */
> /* add Close price to our index OHLC fields */
> AddToComposite(Open, "~CAN SLIM Select Index", "O" );
> AddToComposite(High, "~CAN SLIM Select Index", "H" );
> AddToComposite(Low, "~CAN SLIM Select Index", "L" );
> AddToComposite(Close, "~CAN SLIM Select Index", "C" );
> AddToComposite(Volume, "~CAN SLIM Select Index", "V" );
> /* add one to open intest field (we use this field as a counter) */
> AddToComposite( 1, "~CAN SLIM Select Index", "I" );
> Buy = 0; // required by scan mode
> /* this part is for Indicator Builder */
> PlotForeign("~CAN SLIM Select Index", "~CAN SLIM Select Index",
> colorBlack, style=styleLine);
> Plot(Foreign("~CAN SLIM Select Index","C"),"~CAN SLIM Select
> Index",1,8);
>
> It works fine, however I have to define a filter every time I run
> one of these against a particular Watchlist (In this example the
> Watchlist is caled CAN SLIM Select).
>
> My question is.... Can I put a line of code in this AFL that will
> make it use a specific Watchlist without my having to define a filter
> on the AA screen. I'm sure one of you programming Guru's can show me
> how to do this.
>
> Your help is greatly appreciated.
>
> Don Lindberg
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
>
>
>
>
>

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

__._,_.___

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
Software support Small business finance Business finance online
Business finance training Business finance course

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to