Australian (ASX) Stock Market Forum

Portfolio construction

Joined
13 June 2007
Posts
838
Reactions
136
Greetings all --

Several recent threads in the Yahoo AmiBroker inspired this posting which focuses on issues related to portfolio construction. It may be interesting to some of the ASF members as well. http://finance.groups.yahoo.com/group/amibroker/

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.blueowlpress.com
 
Hi Howard,

Many thanks for that most detailed post.

I must admit to wondering about the practicality and effectiveness of trying to optimize and walk forward a portfolio allocation system (system P in your post). In my view, with the additional optimization variables, system P adds a great deal of complexity and time required for any further testing. The more variables involved in the optimization process, the more difficult it is come forth with robust parameter settings because of the greater scope for curve fitting. Unlike a price and volume chart whereby one could have almost unlimited opportunities to identify edges and validate using proper walk forward procedures, I am not sure that such opportunities exist for system P variables. Then again, maybe I have totally misinterpreted your post.:eek:

I currently run 2 EOD systems on a single IB account. Both systems use STPLMT orders to TRY and initiate their positions, which means that the orders may or may not trigger depending on whether the STP price gets hit. All potential positions will have a STPLMT order submitted for them, and for both systems, that might amount to 40 to 50 STPLMT orders every day, of which typically 4 - 6 will trigger everyday. Sometimes, I may get up to 10 – 12 positions triggering if it’s a really strong trend.

The way in which I control the risk is that at the end of each day, my AFL code will loop through the positions belonging to each system and calculate the risk inherent in each position. Broad risk guidelines have been set down for each system and should one of the systems take on too many positions, the code will rank all the open positions for that system according to their positionscore and select a number of them to be terminated on the next days open, to bring the risk levels back down to acceptable levels.

I find that this method of allocating funds amongst multiple systems trading off a single account works well. As an example if a particular system has a number of open positions that are sufficiently profitable so as to have no risk (ie StopLoss above entry price for long positions) then it can consume as many new positions as it likes, provided there are enough funds for it in the account and every night, their risk levels are recalculated and trimmed down if necessary. This allows one to get the max bang for your bucks for every dollar in your account. Past experience has also showed me that typically the more successful system would normally, by its own accord, generate more signals and therefore result in more trades credited to it and therefore consume a larger slice of the portfolio cake without the need for any manual intervention. So nothing too sophisticated is necessary to divide the available funds amongst the systems competing for it.

On another note, I am also looking forward very much to your new book. I managed to extract a lot of ideas and code from your initial book (Quantitative Trading Systems) and found them to be most helpful.

Finally, its about time you made a trip down-under, considering the number of books that you have sold to Australia. Has a date and venue been finalized for that ATAA meeting as yet ? as I like to be there.
 
Hi Bing --

It sounds like you have method that works well. Trading two systems from one account is manageable without extensive portfolio design.

---------------

I am looking forward to visiting Australia for the ATAA conference. My wife, Mollie, and I spent four months touring New Zealand by bicycle (several years ago). (We do understand that New Zealand is not Australia.) And we had many Australian friends and associates while we lived in Fiji (also several years ago). Mollie will be accompanying me, and we are looking forward to both the conference and a short Australian vacation. Our current plans are to spend most of our time in Victoria -- perhaps a trip to Sydney, and maybe Tasmania.


The ATAA web site is:
http://www.ataa.com.au/

The meetings are set for October 23-25, 2009, at the Melbourne Convention Centre. I am scheduled to give two speeches and be a member of a panel discussion at the conference.

There is a good possibility that I will give some seminars and workshops in trading system design and implementation after the conference. Those plans are still pretty tentative, but they might include topics ranging from an introduction to AmiBroker through AmiBroker master classes, with systems topics related to those in my book, Quantitative Trading Systems, and more advanced topics. If everything stays on schedule, my third book, Advanced AmiBroker, will be coming off the printing presses just about the time of the conference. It will focus on portfolio management, risk management, and implementing those in AmiBroker.

You are right about the popularity of my books in Australia. About 55% of the books we ship go to addresses in the US, about 22% to Australia, Canada and the UK are next with about 3% each. A lot of the credit for the popularity goes to Robert Grigg and the work he has done promoting rule-based technical analysis. Robert is now president of ATAA. I am certain that this conference will be a good one.

Thanks,
Howard
 
Hi All,

I thought we may get a discussion going on the best way to construct a portfolio and which stocks are suitable for different styles of portfolios.

In my own experience in what I have learnt and read over the years I would start by saying that regardless of whether you are looking for growth or income, you will need to select good quality stocks for your portfolio.

Identify the Goal of your Portfolio:

The stocks we select for a SMSF portfolio will be different to the stocks we select for a growth portfolio.
This is an important point as I have seen portfolios constructed with the wrong type of stocks .....what I mean is they were not bad stocks just that they were not suited to the goal of the portfolio.

Develop a list of stocks to suit the Goal of your Portfolio:

Start with the ASX Top 150.

The goal of your portfolio will determine the amount of risk associated with it and therefore the amount of research you will need to undertake to select the most appropriate stocks.

Once you have a selection of stocks for your own portfolio goal we can begin to construct the portfolio.

Below is a general list of portfolio styles that I base my own portfolios on which may help those that may be new to portfolio construction.

Superannuation portfolio:

Initially construct using the Top 20 ASX.

Once you develop more experience you can include stocks in the top 50 to 100 using a 60/40 split.

Blue Chip Portfolio:

A balanced approach between growth and income suited for people who have a low tolerance to risk.

Constructed from the Top 50 ASX.

Once you develop more experience you could include top 50 out to 150 even 200 using a 60/40 split.

Growth Portfolio:

This portfolio is suited for those who are more risk tolerant and willing to spend more time getting a better return on their investments.

Investor:

Top 50 will make up 60% of the portfolio.
Top 51 - 100 will be 40% of the portfolio.

Trader:

More aggressive portfolio

Top 50 will make up 20% of the portfolio
Top 51 - 100 will be 60% of the portfolio
Top 100 - 200 will be 20% of the portfolio.

This portfolio is more concerned with higher growth so many trades will be short to medium term over three to nine months.

Mid-Cap Portfolio:

This type of portfolio needs to be actively managed so you will need to spend a number of hours a week to manage this portfolio. With this type of portfolio trades can move fast but the returns can be greater than 30% in short periods but also a higher percentage of losses as well.

Investor:

No more than 10% stocks outside the Top 150 ASX at any one time.

Top 51 - 100 will be 60% of your portfolio.
Top 100 - 150 will be 40% of your portfolio.

Trader:

As a trader that has a good level of experience in trading outside the top150
you can set your weightings as below.

Top 50.................. will be 10% of your portfolio.
Top 51-100........... will be 60% of your portfolio.
Outside the top 100 will be 30% of your portfolio

These portfolios and their weighting are just a general idea and what helped me get started in portfolio construction with my own portfolios and depending on peoples experience will change the weightings to suit.

Hope this post helps someone. :)
 
Hi All,

I thought we may get a discussion going on the best way to construct a portfolio and which stocks are suitable for different styles of portfolios.

In my own experience in what I have learnt and read over the years I would start by saying that regardless of whether you are looking for growth or income, you will need to select good quality stocks for your portfolio.

Identify the Goal of your Portfolio:

The stocks we select for a SMSF portfolio will be different to the stocks we select for a growth portfolio.
This is an important point as I have seen portfolios constructed with the wrong type of stocks .....what I mean is they were not bad stocks just that they were not suited to the goal of the portfolio.

Develop a list of stocks to suit the Goal of your Portfolio:

Start with the ASX Top 150.

The goal of your portfolio will determine the amount of risk associated with it and therefore the amount of research you will need to undertake to select the most appropriate stocks.

Once you have a selection of stocks for your own portfolio goal we can begin to construct the portfolio.

Below is a general list of portfolio styles that I base my own portfolios on which may help those that may be new to portfolio construction.

Superannuation portfolio:

Initially construct using the Top 20 ASX.

Once you develop more experience you can include stocks in the top 50 to 100 using a 60/40 split.

Blue Chip Portfolio:

A balanced approach between growth and income suited for people who have a low tolerance to risk.

Constructed from the Top 50 ASX.

Once you develop more experience you could include top 50 out to 150 even 200 using a 60/40 split.

Growth Portfolio:

This portfolio is suited for those who are more risk tolerant and willing to spend more time getting a better return on their investments.

Investor:

Top 50 will make up 60% of the portfolio.
Top 51 - 100 will be 40% of the portfolio.

Trader:

More aggressive portfolio

Top 50 will make up 20% of the portfolio
Top 51 - 100 will be 60% of the portfolio
Top 100 - 200 will be 20% of the portfolio.

This portfolio is more concerned with higher growth so many trades will be short to medium term over three to nine months.

Mid-Cap Portfolio:

This type of portfolio needs to be actively managed so you will need to spend a number of hours a week to manage this portfolio. With this type of portfolio trades can move fast but the returns can be greater than 30% in short periods but also a higher percentage of losses as well.

Investor:

No more than 10% stocks outside the Top 150 ASX at any one time.

Top 51 - 100 will be 60% of your portfolio.
Top 100 - 150 will be 40% of your portfolio.

Trader:

As a trader that has a good level of experience in trading outside the top150
you can set your weightings as below.

Top 50.................. will be 10% of your portfolio.
Top 51-100........... will be 60% of your portfolio.
Outside the top 100 will be 30% of your portfolio

These portfolios and their weighting are just a general idea and what helped me get started in portfolio construction with my own portfolios and depending on peoples experience will change the weightings to suit.

Hope this post helps someone. :)

Whatever happen to just buying good businesses, preferably across two or three industry you can understand. And that's about it regarding diversification.

I think portfolio construction ought to only be a rule of thumb. Leave the maths to measuring good businesses.

Detailed "balancing" is only useful when you manage other people's money - you don't want to be too clever and you need to cover yourself.. .that and doing average mean job security while doing smart and getting wrong means going home.
 
Greetings --

Be aware of several issues when constructing and testing portfolios.

1. Survivorship.
2. Selection.
3. Correlation.
4. Non-stationarity.
5. Risk from holding long periods of time.
6. Low number of data points in each test period.

Best,
Howard
 
Whatever happen to just buying good businesses, preferably across two or three industry you can understand. And that's about it regarding diversification.

Agree and somewhere between 5- 12 stocks (closer to 5) usually suits me.

I think portfolio construction ought to only be a rule of thumb....

Agree also


Leave the maths to measuring good businesses.

This is one area I need to understand better myself. I prefer others to work out the fundamentals / maths of the companies as to whether they are sound businesses or not and when I have that list I will use my Technical analysis to tell me whether now is the right time to buy the company or not. This works for me the best.

Detailed "balancing" is only useful when you manage other people's money - you don't want to be too clever and you need to cover yourself.. .that and doing average mean job security while doing smart and getting wrong
means going home.

Yes ...I see your point..

From my perspective with my own personal portfolios I like to have specific stocks in specific portfolios so I run two too help me there,

For example I would never have a stock that was a say Top 200 in a Superannuation fund no matter how good the business looked...just my own opinion though.

Thanks for your comments Luutzu much appreciated

I am sure this is how we all benefit by others own experience.
 
Greetings --

Be aware of several issues when constructing and testing portfolios.

1. Survivorship.
2. Selection.
3. Correlation.
4. Non-stationarity.
5. Risk from holding long periods of time.
6. Low number of data points in each test period.

Best,
Howard


Thanks for the reply Howard.
 
Top