[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Looking at composites as you are building them...



PureBytes Links

Trading Reference Links




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.
<FONT face=Arial color=#0000ff 
size=2> 
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:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>TotalCapitalRequired = 
Foreign("~Capital","Close",fixup=1);
<FONT face=Arial color=#0000ff 
size=2> 
I then 
might say something like:
<FONT face=Arial color=#0000ff 
size=2> 
Buy = 
Close > MA(Close,50) and TotalCapitalRequired < 
100000;
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 
This 
doesn't seem to work.   It still takes every trade and the capital 
composite keeps growing well past the 100,000 mark.
<FONT face=Arial color=#0000ff 
size=2> 
I tried 
this:
<FONT face=Arial color=#0000ff 
size=2> 

<FONT face=Arial color=#0000ff 
size=2>TotalCapitalRequired = 
ref(Foreign("~Capital","Close",fixup=1),-1);
<FONT face=Arial color=#0000ff 
size=2> 
It 
didn't do the job either.
<FONT face=Arial color=#0000ff 
size=2> 
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.
<FONT face=Arial color=#0000ff 
size=2> 
Any 
input would be appreciated.
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>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 face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 






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.