PureBytes Links
Trading Reference Links
|
Ken...
I see it a bit differently.
<FONT face=Arial color=#0000ff
size=2>
Let's
say that my Scan has completely processed ten stocks, from the first date to the
last date. If I cancel the run at that point, the composite has been
updated to reflect the capital required for all ten stocks, every
day.
<FONT face=Arial color=#0000ff
size=2>
As AB
is doing the eleventh stock and it's one year into the data, the composite has
been updated to reflect that fact. Perhaps it has been updated
only in cache and the "Foreign" statement can't see it. But surely
it doesn't have to run through all of the stocks in the watchlist before
updating (at least virtually) the composite. It's not a matter of
how many times each statement is executed. Yes, each statement
is execute only once.... ONCE PER DAY. Therefore, the composite is
updated every day, albeit possibly in memory only and the "Foreign" statement
doesn't look in memory.
<FONT face=Arial color=#0000ff
size=2>
TJ
could answer this question in four nanoseconds.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Cheerio
<BLOCKQUOTE
>
<FONT face="Times New Roman"
size=2>-----Original Message-----From: Ken Close
[mailto:closeks@xxxxxxxx]Sent: Sunday, April 13, 2003 6:21
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker]
Looking at composites as you are building them...
<SPAN
>Chuck: I am not sure
but based on the rule I drilled into my head relating to AFL prior to the new
release today, every statement is executed only once.
<SPAN
>
<SPAN
>The AddtoComposite
statement has to run thru all the stocks in the watchlist, adding whatever
variable is specified, and it does not make sense that you could “read it”
later, in some intermediate state, in the flow of your code (each line of
which is executed only once).
<SPAN
>
<SPAN
>So, it does not seem
to be any kind of “bug” in AB but rather an expectation that the things works
differently than it really does.
<SPAN
>
<SPAN
>All that having been
said, perhaps now with the For, Else, While looping capability, you can
execute the AddtoComposite multiple of times. Or, alternatively, just
create a variable that holds your Equity on each pass of the “outer loop” you
have created. I may be assuming more to this looping that is really
possible but maybe it would work.
<SPAN
>
<SPAN
>Ken
<SPAN
>
<SPAN
>-----Original
Message-----From: Chuck
Rademacher [mailto:chuck_rademacher@xxxxxxxxxx] <SPAN
>Sent: Sunday, April 13, 2003 5:09
PMTo:
amibroker@xxxxxxxxxxxxxxx<SPAN
>Subject: [amibroker] Looking at
composites as you are building them...
<SPAN
>
<SPAN
>I have written some
logic that will AddToComposte the capital required to trade. Let's
say that I have a system that trades IBM, long only, and buys every January
and sells every June. I'm trying to keep it simple. If
the system trades $10,000, I will need $10,000 to trade IBM for January
through May and I won't need any capital for the rest of the year.
The system will take long positions in other stocks during different
months. My composite, therefore, will show me how much
capital is required to take every trade over the period in my
backtest. This all seems to work fine.
<SPAN
>
<SPAN
>I then tried to
modify the program so that it looks at the composite as it is being
built. The objective is to stop taking new signals when I run out
of cash. The code looks like:
<SPAN
>
<SPAN
>TotalCapitalRequired
= Foreign("~Capital","Close",fixup=1);
<SPAN
>
<SPAN
>I then might say
something like:
<SPAN
>
<SPAN
>Buy = Close >
MA(Close,50) and TotalCapitalRequired < 100000;
<SPAN
>
<SPAN
>
<SPAN
>This doesn't seem to
work. It still takes every trade and the capital composite keeps
growing well past the 100,000 mark.
<SPAN
>
<SPAN
>I tried
this:
<SPAN
>
<SPAN
>TotalCapitalRequired
= ref(Foreign("~Capital","Close",fixup=1),-1);
<SPAN
>
<SPAN
>It didn't do the job
either.
<SPAN
>
<SPAN
>This is probably a
question for TJ, but is it possible to access the composite as it is being
updated? My testing suggests that it cannot be
done.
<SPAN
>
<SPAN
>Any input would be
appreciated.
<SPAN
>
<SPAN
>
<SPAN
>
<SPAN
>P.S. I
realise that (if I could get this to work) the system will stop trading
stocks based purely on where they sit in the alphabet. I also
believe that "A" stocks have a certain bias. With these two points
in mind, I actually use randomly assigned symbols for my stocks during the
optimizing process.
<SPAN
>
<SPAN
>
<SPAN
>
<SPAN
><FONT
face="Courier New" size=2>Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<SPAN
><FONT
face="Courier New">Send SUGGESTIONS to
suggest@xxxxxxxxxxxxx<FONT
face="Courier New">-----------------------------------------<FONT
face="Courier New">Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx (Web
page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT
face="Courier New">--------------------------------------------<FONT
face="Courier New">Check group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your
use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of
Service.
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|