PureBytes Links
Trading Reference Links
|
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.
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).
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.
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.
Ken
-----Original Message-----
From: Chuck Rademacher
[mailto:chuck_rademacher@xxxxxxxxxx]
Sent: Sunday, April 13, 2003 5:09
PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Looking at
composites as you are building them...
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.
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:
TotalCapitalRequired =
Foreign("~Capital","Close",fixup=1);
I then might say something like:
Buy = Close > MA(Close,50) and
TotalCapitalRequired < 100000;
This doesn't seem to work. It
still takes every trade and the capital composite keeps growing well past the
100,000 mark.
I tried this:
TotalCapitalRequired =
ref(Foreign("~Capital","Close",fixup=1),-1);
It didn't do the job either.
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.
Any input would be appreciated.
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.
<font size=2
face="Courier New">Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<span
>
Send 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 Yahoo!
Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
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.
|