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

Re: [amibroker] Question about enhanced backtest reports



PureBytes Links

Trading Reference Links

Al Venosa reasonably asked:

> Why do you say portfolios are not well adapted to futures trading?

With futures, you have a number of considerations that do not apply to
stocks.  I did not want to take up bandwidth with stuff people might already
know, but nearly everyone here trades equities, so...

One problem is TickSize.  It's different for each vehicle.  So if I want to
trade the e-mini S&P, TickSize gets set to 0.25.  For the full-sized S&P,
it's 0.10.  For T-bonds, it is 0.03125, and for T-notes it's half that.  AB
cannot check what contract is being tested, so you need a different
portfolio for each futures market.  (I assume you can have more than one
portfolio; will read the instructions when done writing this.)

Then there is the problem of when you want to trade a given contract.
Futures contracts can be around for a year or two, or even three or four
years, for the convenience of the producers, buyers, and other long-term
players who justify the existence of futures markets.  However, traders only
deal with them for a short part of the contract life.  Omit the last month,
because volume drops off rapidly due to issues about taking delivery of the
underlying, which no speculator wants to bother with.  The active parts of
the contract's life will be the two or three months before that, depending
on how many contracts there are in a year.  For the S&P and T-bonds, it's
four contracts per year, so you follow each contract for one-fourth of the
year.

Note that all this is a simplification, because the transition can take
place up to a week before or after the the last month begins; sometimes even
a day or two longer.  It depends on the number of contracts outstanding, the
daily volume (a positive feedback loop), some details of the contract
specifications, and probably custom.  Changing at the end of the
next-to-last month seems close enough for practical testing, though.

What all this amounts to is that each test must be limited to the months in
which you would trade that specific contract.  For example, a March T-bonds
or S&P contract calls for testing the preceding December, January, and
February.  So I've made a header file containing, among other things, some
code that limits each test to the appropriate months.  (If I ever want to
look at a vehicle that trades more than four contracts per year, it will be
necessary to write another header file.)  I step through each set of
contracts by hand and, when it seems worth the bother--not often--summarize
the results in Excel.

Until recently, I set the months-to-trade variable manually, which prevented
using even a single-contract portfolio.  It finally dawned on me to use
LastValue(Month()), and that does make it reasonable to treat each futures
market as a unit.  If I can have more than one portfolio, this will save me
a good deal of fiddling.  Thanks for prompting me to think about it again.

However, it will not be possible to test a bunch of different vehicles in a
single portfolio until AB can identify the contract it's using.  This is
mandatory for testing long-term trend-following methods, which work only
when applied to a variety of vehicles.

Given how much better AB is than anything else I've ever tried, I am not
inclined to complain much about this limitation.

> BTW, I suspect you got all 0's because you did not have a positionsize
> statement at the end of your code.

Could be.  My positionsize statement is at the beginning of the code,
because it's part of the header file, but I'll see whether it makes a
difference.
....

Nope.  Didn't help.  Thanks anyway.

Owen


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/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/