PureBytes Links
Trading Reference Links
|
I constructed a simple backtest on a portfolio of
only six (6) stocks consisting of ABC, BMY, CSCO,
F, IBM, S. (Note that the tickers are in
alphabetical sequence.)
In order to restrict the output for easy
reference to the results I specified a testing
period of 01/01/2003 to 04/04/2003. It generated
30 trades but AB reported a count of 29 (I think
AB failed to count one trade that was reported as
"Open Long").
The settings allowed initial equity of 20000 and
allowed position size shrinking.
Here is the AFL:
// Test system to observe AFL action
SetTradeDelays(1,0,0,0);
Buy=Cross(C,MA(C,50));
exit= Ref(L,-1);
ApplyStop(stopTypeTrailing,stopModePoint,exit,True,False);
//Sell=Cross(MA(C,50),C);
Sell = L<exit;
Short = Cross(MA(C,50),C);
exit = Ref(H,-1);
Cover = H>exit;
I exported the trades to a test.csv file
(Attached) and loaded it into XL.
Initial load of test.csv into Excel is in the
exact as produced by the backtest.
NOTICE that the 'Position Value' column reflects
the adjusted Positionsize based upon the
preceeding trade Profit or Loss. Also notice that
AB calculated the the Positionsize based upon the
Alphabetical sequence of the watch list.
ALSO NOTICE that the sequence of trades ARE NOT
the sequence that you would have actually made
the trades in.
If you will select Data/Sort and then specify the
"Exit Trade Date" column as the primary ascending
sort sequence you will then be viewing the
Chronological Order of the trades (which would
have been the trade sequence affecting account
P/L and which you would have used if ACTUALLY
trading this system). Also notice that the
'Position Value' column in this view NO LONGER
tracks the preceeding Profit or Loss figures from
what would have been the REAL trading sequence.
What does this mean?
If you track AB backtests on multiple issues over
longer periods of time then major mkt moves which
could result in severe chronological order
multiple-position drawdowns are obscured in the
Alphabetical view.
So... once the Positionsize Shrinking affect (in
non-chronological order) has taken place, any
further analysis of the generated trade data is
really misleading and could get you in real
trouble if you try to structure a real life
trading system from the reported data.
And of course it doesn't matter what real Ticker
List sequence is that drove the backtest, the
resulting Positionsize calculations are still not
based upon the chronological sequence that is
need to simulate Real World Trading.
BTW, I had this same problem with my home
developed backtesting system. It would be a very
significant effort to try to engineer the
software to do chronological order
positionsizing. One thing my software does
differently from AB is to split the trade records
into seperate records for the entry and exit.
This allowed me within XL to then sort
chronologically and do 'market risk' calculations
showing how much capital was exposed to the
market in open positions at any given time.
Also, yes I do limit my actual trades to fixed
amounts. If I am working with a system that I
consider statistically reliable enough to trade,
I'd rather take more trades with smaller fixed
amounts rather than taking the huge risk in a
compounded position of being caught holding the
next Enron.
Phsst
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get a FREE REFINANCE QUOTE - click here!
http://us.click.yahoo.com/2CXtTB/ca0FAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->
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 http://docs.yahoo.com/info/terms/
Attachment:
test.csv
Attachment:
Description: "Description: test.csv"
|