PureBytes Links
Trading Reference Links
|
I
thought that I would share some of my trials and tribulations using AmiBroker
with other members of this group.
<FONT face=Arial color=#0000ff
size=2>
In
order for you to appreciate the problems that I was encountering, I need to
describe my environment:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>1. I'm backtesting systems over 14,000 (or so) stocks and 12 years
of data.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>2. More than half of the stocks are now extinct (no longer
trade).
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>3. I am a "newbie" to AmiBroker, but not system
trading.
<FONT face=Arial color=#0000ff
size=2>
Last
week, I mentioned the first problem that I encountered. My equity
curve was climbing during periods when I knew the system wasn't making
money. This was caused by new stocks entering into the mix
throughout the backtest. Every time a new stock started trading, my
equity curve shot up by the amount of the initial capital. I cured
this problem by using the following statement:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>AddToComposite (Equity()-10000, "~CompositeEquity", "X", 7)
(where 10000 is my initial capital)
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
I have
spent just under 50 straight hours trying to find and fix the next
problem. As extinct stocks ceased trading, their equity went to
zero. Where this really showed up was when the system purchased BVSN
for $10,000 and sold it for $243,000. A week later, the $243,000
became zero.
<FONT face=Arial color=#0000ff
size=2>
Maybe
some of you younger dudes (and dudesses) would have realized quicker than I did
what was happening. Now that I've found and fixed the problem, I
thought that I would share it with you. Of course, I doubt that many of
you are backtesting extinct stocks... but you should be!!
<FONT face=Arial color=#0000ff
size=2>
In
order to fix the problem, I had to "manufacture" trailing price data for each
stock after it ceased trading. I used IBM as my date template and
created one day of price data for each missing day. I simply repeated the
last real close for the open, high, low and close for each missing
day. I set the volume to zero to make sure that I don't accidentally
trade it again.
<FONT face=Arial color=#0000ff
size=2>
This
works fine, but was a bit of a challenge.
<FONT face=Arial color=#0000ff
size=2>
So,
now you have no excuse for not backtesting extinct stocks in order to see how
your systems really would have behaved five, eight or ten years
ago.
<FONT face=Arial color=#0000ff
size=2>
By the
way, I place the "real" closing price in the open interest field in order to do
filtering based on price. You can't really be serious about
filtering out stocks trading below (say) $1 when you are using backadjusted data
unless you do something similar to what I've done.
<FONT face=Arial color=#0000ff
size=2>
Now...
I think I can get on with my real work.
<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.
|