|
Mark: I am blown away as well as grateful for the
work you have done. Most generous of you and it (probably) will get me
going on what I want to try to accomplish.
I say probably because I have various questions before I
can begin to even try to run this, questions of an operation nature and
questions of a programming nature.
Will you please follow through and offer some "teaching"
kinds of replies to these, helping me and perhaps many others do some good
learning here.
OPERATIONAL QUESTIONS:
1. Why are there two sections to the code, a
SCAN section and an EXPLORE section? Which runs first and
why?
From my reading of the code, the Explore section
seems like it must run first (as it establishes the variable "COMPNAME" and
loads the symbol data.
Related to this is getting the code to run
unattended or automatically. It seems like the Scan section should be put
below the Explore section and then commands inserted to first run an explore
then switch to Scan.
But initially it can certainly be executed twice
from the AA window.
2. This line is puzzling and I do not see
how the code picks up the filename and path to the list of
tickers:
values = ab.Stocks("~VALUES"); // get the filename and listname from the
bogus stock
It seems like
the bogus stock is added to the overall QP database (AB.Stocks.Add("~VALUES");)
but I have multiple lists of symbols organized into distinct TLS files
elsewhere.
So the question is: what format should
the symbol list(s) be in and where should they be
located?
3. Are operations such as
"CreateObject" and FOpen only able to be accomplished in EXPLORE mode, and if so
why is this?
(perhaps too general a question but certainly
would offer some insights to those of us who do not know)
PROGRAMMING QUESTIONS:
Comment: I tune with learn-it-your-self, I just visited and
spent some time browsing the jscript pages at microsoft plus some of the help
files in AB--I might find these answers after weeks of
reading...)
1. How does the "Alias" command
work?
2. Some one said paths needed
double slashes (//)--I assume this is unnecessary as you never explicitly write
explicit paths in your code. Correct?
3. You have two string replace
commands when you are "GETTING" the symbols--I guess the "\n" is a carriage
return, what is the "\r"?? And why is this
necessary?
4. To control all this
automatically and loop to do multiple symbol lists, well, a loop is necessary
around all of your code, hence the need to switch between SCAN and EXPLORE
modes. I thought
that AddtoComposites would or could work
in EXPLORE mode (in fact you have a single ATC command in the Explore section -
adding a zero -- why?)
5. The file operation code never
closes the file it opens. Fred seemed to imply the code had to close any
file it opened?
After all you have done, you may say Geeezzzz and just
leave me to find my own answers to these questions, and, if so, I
understand and will forge onward, but if you want to expand on some of these
questions that, too, would be most appreciated.
Many thanks for this work.
Ken
PS: If I ever get all of this figured out and
working, I am committed to uploading a complete file of the methods and
background for others to use in the future.
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 -----
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 -----
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
__,_._,___
|