|
Ken:
Here are the steps to run the code: (I have attached a new
version with some minor correction to the JScript)
1. Save the ListComp.afl under C:\\Program
Files\\AmiBroker\\Formulas\\Custom.
2. Save the ListsComp.js under C:\\Program
Files\\AmiBroker\\Scripts
3. Copy all your list files under C:\\Program
Files\\AmiBroker\\MyLists
4. Double-click the ListsComp.js you just saved. It starts
to run.
I am trying to answer your questions as best as I
can.
First of all, you can't run the AFL manually from the AA
windows, it has to be called from the JScript because it consumes some
information passed from the JScript.
The key to understand them
is starting examine the JScript first, not the AFL. It will be easier
than you think if you do that. JScript has similar syntax to AFL and should be
readable even you has yet written any yet.
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.
The JScript determine the order, Explore() is called first
and Scan() later. As I said you can't run the AFL from 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("~
It seems like
the bogus stock is added to the overall QP database
(AB.Stocks.Add(
So the question is: what format should
the symbol list(s) be in and where should they be
located?
The bogus stock is used to pass information between JScript
and AFL. See my instructions at the beginning of this post to see for the
location you should put your lists.
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)
I think you can do it anywhere, but in this example there
is no need to do it somewhere else.
PROGRAMMING QUESTIONS:
Comment: I tune with learn-it-your-
1. How does the "Alias" command
work?
As I said, the bogus stock "~VALUES" is used to pass info
from JScript to AFL. The "Alias" field is used to store the list
name.
2. Some one said paths needed
double slashes (//)--I assume this is unnecessary as you never explicitly write
explicit paths in your code. Correct?
If you look at the JScript, I did use "\\". There are no
explicit paths in AFL since they are passed from the
JScript.
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?
Because fgets() also return the end of line character
("\r\n") attached to the tickers. You have to remove them otherwise the tickers
are wrong.
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?)
The loop
is in the JScript. No need in the AFL. The ATC in the Explore mode just creates
an empty composite so that it can been added to watchlist CompWatchlist. (It is
basically the last step (d) you wanted to do in your previous
post)
5. The file operation code never
closes the file it opens. Fred seemed to imply the code had to close any
file it opened?
My omission. But it should not affect the AFL because it is
called by the JScript and the file should close automatically after every run. I
have added it in the updated version I am attaching
though.
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.
I think if you read the JScript first, you wouldn't have
all the questions you had :-)
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.
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
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 __,_._,___ |
ListsComp.js
Description: Binary data
ListComp.afl
Description: Binary data
