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

Re: [amibroker] Portfolio construction



PureBytes Links

Trading Reference Links



Hello Howard,

Very thoughtful post. I'm not used to some of the terms
in the community yet, so could I get some clarification
please?

<....> an individual trading system that uses equity curve feedback
to gate trades<...>

Not familiar with concepts of "equity curve gating" - or certainly
not under that name. How would this "gating" process work? I'm
assuming that some attribute of the equity curve [ absolute P&L, 
variance, slope ] is used to "allow" a trade to occur. I'm guessing
though. Examples and/or references please?

If you are trading a single system with equity curve gating to
to initiate a trade ( an assumption on my part ), then how do
you get the first trade after a failure to gate? If the system
isn't trading, then how can the equity change?

<...> multistage approach assumes that the best individual A, B,
and C create the best portfolio P. <...>

I'm hard pressed to see where the assumption comes from. I
certainly disagree with it strongly. I think that certain objective
functions for portfolio optimality would need "negative return"
systems included, particularly where the objective function
emphasises low variance.  I am thinking about OTM Puts. I
think the target for portfolio optimisation should be more
than the sum of it's parts - it should be synergistic.

Look at it this way, I have been taking a bet every year for
the last 20 or so years, and every year I lose - and I'm happy
that I lose, and I will keep taking this bet for the rest of my life.

Every year I bet about $1,000 that my house will be destroyed.
In the portfolio of all my assets/liabilites and income/expenditure
it's a good bet.

Your article also raises a few questions about WFA itself - not a
criticism of your examples - I have no empirical knowledge
of it's application but I was doing some modelling on the WFA
process before I found AB, so I'm familiar with Pardo, but
I'm not sure though that I totally agreewith all he propounds.

I haven'nt fully clarified ( or is it congealed ) my thoughts on
this, but WFA in these groups is often mentioned as a
validation process but often seems to be used as a dynamic
optimisation process. To my way of thinking these are two
separate beasts.

I digress, I don't want to turn this into a WFA thread, the
portfolio stuff is big enough on it's own.

Thanks for the post Howard

Regs

Robert Z





From: Howard Bandy <howardbandy@xxxxxxxxx>
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, 9 May, 2009 3:52:36 AM
Subject: [amibroker] Portfolio construction

Greetings all --

Several recent threads that inspired this posting which focuses on issues related to portfolio construction.

Portfolio construction is an interesting and important problem. But it is not easily solved without either violating good modeling and simulation practices or making some restrictive assumptions.

One complication arises from the two-stage nature of the portfolio creation. Stage one is system development for the individual trading systems, call them A, B, and C; stage two is the system development for the portfolio system, call it P. The portfolio, P, draws from a single trading account and allocates resources to trades signaled by A, B, and C. The desire is to construct the portfolio to manage resource allocation, manage risk, net out trades, and so forth.

To begin, I'll give a simpler illustration -- an individual trading system that uses equity curve feedback to gate trades. There are two stages in this system. The basic logic of the system, call it D, and the equity curve filter logic, call it E. There is afl code for each stage, and the goodness of each stage can be measured by the score of the objective function.

Assume that system D is developed by itself, without the equity curve feedback logic in its afl. System D produces buy and sell signals and a resulting equity curve. If there were no equity curve filter logic to follow, this is the system that would be tested and validated through use of the walk forward process. But these signals and this equity curve are not final -- they will be passed to the equity curve filter logic. Call the results from system D the "shadow" results. The equity curve filter logic, in its own afl module, accepts the shadow results data series produced by D as its input. That is, the shadow buy, sell, and equity from D are input to E. System E has logic and parameters which are adjusted in a system development process and evaluated by computing an objective function. System E must pass the validation process. System E cannot use the same in-sample period that was used to develop system D. The output from that period is "too good" and is not representative. The equity curve logic, system E, must use out-of-sample results from system D as its in-sample data. The complication this creates is that the two stages use different data streams and different data periods for their respective in-sample processing. It will probably be necessary for system D to write its shadow output to a temporary data file, and for that data file to be edited so that it contains only system D's out-of-sample results concatenated together so system E can process them.

Alternately, assume the equity curve filter logic, E, is incorporated with the logic of system D into a single afl code module. Call that new system DE. The shadow trades and signals from the D logic are processed by the E logic during a single pass. The in-sample period is the same. The output is already gated. The system DE can be validated in one pass.

Moving on to the creation of the portfolio. Portfolio logic -- that is trade selection and position sizing logic for the portfolio -- is similar to equity curve filter logic -- it is a second phase. It is a trading system in its own right. Its logic and parameter values will be selected through an optimization process, and its result will be evaluated by an objective function. The objective function for the portfolio may have different component metrics than the objective function for the individual systems. For example, it may have trade size and risk components in addition to the more traditional components such as equity curve smoothness.

An immediate question that arises is whether to use systems A, B, and C as they are individually developed at their individual optimums. Or if there are better logic and parameter choices for A, B, and C as they are to be combined into a single portfolio.

Again, the choice will be between multistage development and single stage development.

The multistage approach assumes that the best individual A, B, and C create the best portfolio P. This approach has each of A, B, and C being developed, tested, and validated separately. The output of these systems is again "shadow" output, since it must be processed by the portfolio logic. Again, temporary files will be necessary and only the shadow output's out-of-sample results can be used for the portfolio development. The messiness and complexity of portfolio construction has increased considerably over the equity curve example.

When we consider performing the entire portfolio development in a single pass, some other issues arise.

One is the curse of dimensionality -- the increase in the dimension of the search space for logic and parameters. If each of A, B, and C have four optimizable parameters, each with ten steps, an exhaustive search will create and evaluate 10,000 alternatives for each system. If P has two optimizable parameters, each with ten steps, an exhaustive search will create and evaluate 100 alternatives. The total is 30,100. At 1000 per minute, this takes 30 minutes. If those same parameters are searched in the all-in-one logic, which now has fourteen parameters, an exhaustive search will create and evaluate 10 to the 14th power alternatives. At 1000 per minute, this takes about 200,000 years. AmiBroker's non-exhaustive search will help, but this will still be a long run.

Another, perhaps more significant, issue is the standardization of the length of the in-sample periods. Each system is a combination of a model (the part that contains the logic) and the data processed by that model. The system will have a sweet spot in terms of in-sample length. Using too short an in-sample period does not allow the logic to identify the pattern it is designed for; while using too long an in-sample period dilutes the data and lowers the signal to noise ratio. A system that trades the S&P long and short with five day holding periods will probably not have the same in-sample length as a system that rotates among nine sector ETFs with 20 day holding periods. But, if P, the all-in-one system, is to be tested and validated using automated walk forward procedures, the in-sample period will the same for all the individual systems and the portfolio. Of course, at the cost of additional complexity, the in-sample length could be set to the longest period needed, and those systems that need shorter periods could include logic to ignore the first portion of data. The in-sample results from the starting date up to the date when all the systems are active would have to be ignored when computing P's objective function.

Note also that, when each of systems A, B, and C are being tested separately, they each have their own objective function. The objective function for the system that swing trades might be different than the one for the sector ETF rotator. The objective function guiding development of the all-in-one portfolio system, P, is different still. Unless care is taken to gather trade statistics from each of systems A, B, and C, and apply whatever internal filtering is desired, it is quite possible that the parameters chosen for A, B, or C, in the effort to satisfy P, will result in non-optimal choices for A, B, or C. In fact, there might be intentional losing trades and a very ugly equity curve when it is viewed by itself. Unless the person trading this system understands the process by which it was created and is comfortable with it, they may decide to pass some signaled trades that appear to be obvious losers, thereby changing the system completely.

All of these issues must be considered and dealt with before going on to position sizing -- fixed fraction, fixed ratio, optimal f, partial f, and so forth -- which is much more complex for a portfolio than for an individual trading system.

All in all, portfolio creation and management is more complex than it appears at first glance. In my next book, "Advanced AmiBroker," I will be discussing these issues in more detail, and making suggestions for measuring and managing portfolios. That book is scheduled to be out near the end of 2009, after my return from speaking at the Australian Technical Analysts Association annual meeting. http://www.ataa. com.au/

As always, this is my opinion. If whatever you are doing now works for you, ignore me and don't change a thing.

Thanks for listening,
Howard
http://www.blueowlp ress.com



Chat right from the comfort of your inbox. Show me how..

__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___