Feature Archives

Buying a Computer

Trends in the computing industry and issues to consider before purchasing a new computer or upgrading your current system.


Analyzing, selecting and trading exchange-traded funds

Investor Sentiment

Using investor sentiment to indentify tops and bottoms in the market.

Market Breadth & Timing

Market breadth and momentum indicators to gauge the market's overall direction.

Mutual Fund Screening & Analysis

Screening for and analyzing mutual funds.

Online Discount Brokers

In-depth reviews of online discount brokers and their tools, features and flaws.

Portfolio Management

Constructing a portfolio of investments and the issues involved, including risk management.

Software Reviews

In-depth reviews of some of the most popular investment-related software.

Stock Screening & Analysis

Using quantitative stock screening filters to identify possible investment and analyzing individual stocks.

Stock Valuation

Determining the "true worth" of a company.

Technical Analysis & Charting

Using technical indicators and charts to help time your buy and sell decisions.

Tax Preparation

Using computerized tools and resources to prepare and file your personal income taxes.
Computerized Investing > Third Quarter 2012

Portfolio Optimization Program Finds Efficient Frontier

| | COMMENTS (9) | A A   Reset

by Joe Lan

Modern portfolio theory (MPT) attempts to use relationships between securities to maximize the return obtainable for a given amount of risk. The theory is based on the premise that through diversification, it is possible to achieve a combination of assets that has a lower risk than any of the individual assets. The theory states that for each portfolio of stocks, an efficient frontier exists that contains combinations of stocks within the portfolio that provide the highest return for a given level of risk, or the lowest risk for a given return.

It is fairly simple to conceptualize how a collection of holdings can have lower risk than any individual holding. Consider an overly simplified example of two assets that are perfectly negatively correlated (e.g., as one variable increases, the other decreases by the same amount). In this case, the two assets when held together provide some weighted return but their collective risk, measured by volatility, is zero. Due to their perfectly negative correlation, when one asset appreciates, the other will depreciate by the same amount.

Although the concept is fairly simple, the question that remains is how an individual investor would implement such a strategy. In this Feature article, I use the Portfolio Optimization (PO) program developed by AAII member David Herron, which is available free of charge to AAII members in the Download Library, in order to create “efficient portfolios.” The program uses MPT to identity efficient combinations of stocks and mutual funds with the lowest possible level of risk for a specified annual portfolio return. Currently, the program only runs on 32-bit operating systems. The tests performed in this article were done using a Windows 7 Ultimate 64-bit computer while running Windows XP Mode utility, which can be downloaded in full from the Microsoft website.

Performing Backtests

The Portfolio Optimization program is available to AAII members through the Download Library at www.aaii.com/download-library, in both the Financial Planning and Portfolio Management sections. After downloading the program, the installation process creates a “PO” folder on your local disk drive (usually the C: drive). The program and all its functions are performed, and results are saved, directly in this folder.

The main program window provides seven options for running the program. The first step to creating an efficient portfolio is to create a sample file. At the main menu, press 2, which allows you to “Prepare/Modify/Recall SAMPLE FILE” to calculate efficient portfolios. A sample file is the portfolio of stocks the program uses to calculate the efficient frontier. To keep this example simple, press 1 for “Display/Modify an EXISTING SAMPLE FILE.” You may also press 2 to CREATE A NEW SAMPLE FILE. The PO database has annual returns for the past 10 years for all stocks from AAII’s Stock Investor Pro and all mutual funds from AAII’s Quarterly Mutual Fund Update. At the next screen, type in djia2012 to select the sample file that comes with the program. The next screen shows the stocks contained in the sample file (which in this case is the stocks of the DJIA) and their yearly returns for the past 10 years. (The annual returns provided by PO are all calculated based on company closing prices in the Stock Investor Pro database.) Figure 1 shows the resulting document for the sample file with yearly returns for each DJIA stock along with geometric (compound) average returns and standard deviations.

Source: Portfolio Optimization, David Herron. Data provided by AAII’s Stock Investor Pro/Thomson Reuters.

After answering yes or no, PO provides five choices—Find EM’s, Change yrs, Main Menu, Delete security and Add security. To calculate the efficient portfolio for the sample file of stocks, first select the years by pressing 2. To calculate the 2011 efficient portfolio for our test, we use the years 2007–2010. After the years are specified, press 1 to find the efficient portfolio.

On the next screen, the program asks whether you want to specify a minimum required return. Answering no to this question will prompt the program to provide several portfolios on the efficient frontier, including the efficient portfolio with the highest return. The program then asks you to provide the maximum fraction for any one security (maximum percentage that any one security can be of the total portfolio). This is to ensure diversification. The problem with this type of optimization normally occurs because a few securities have very high returns relative to their volatility and they would dominate the portfolio without constraints. If you do not specify a fraction, the program will show the highest return portfolio as consisting of the single security that achieved the greatest return over your specified period. For our sample backtest, I chose to limit the maximum fraction of any one security to 20%. The efficient portfolios for 2011 can be seen in Figure 2.

Source: Portfolio Optimization, David Herron. Data provided by AAII’s Stock Investor Pro/Thomson Reuters.

The results show the stocks along with the percent of each that make up each of the efficient portfolios along the efficient frontier. As you can see in Figure 2, the efficient portfolio that was able to generate 6.0% annualized return had a standard deviation of 3.17%. As the return increases, so does the standard deviation. Each of these efficient portfolios along the efficient frontier offers the lowest standard deviation for the level of return.

Looking at the Numbers

The results gathered using the Portfolio Optimization program are impressive, but keep in mind these portfolios were constructed with the historical data. Figure 2 shows four efficient portfolios calculated by the Portfolio Optimization program. Keep in mind that as a parameter, no single stock can be more than 20% of the entire portfolio. The results shown in Figure 2 provide the portfolio mix of stocks with the lowest standard deviation at 6%, 8%, 10% and 12% returns.

  Annual Return (%) Avg Annual
St Dev
2011 2010 2009 2008 2007 2006 (%)
DJIA Selections 16.40 28.54 2.02 –20.12 21.06 17.56 9.62 17.49
DJIA 8.40 14.10 22.70 –31.90 8.90 19.00 4.99 19.80
VMCIX Selections 25.58 70.70 35.03 –28.56 3.52 16.66 16.48 33.07
VMCIX –1.96 25.67 40.51 –41.76 6.22 13.78 3.35 28.20
VMCIX 2nd-Highest Selections 36.50 51.00 46.22 –26.22 26.32 28.15 23.80 27.82
VMCIX –1.96 25.67 40.51 –41.76 6.22 13.78 3.35 28.20

As shown in Figure 2, the allocation for the efficient portfolio with the highest return is 19.5% in Caterpillar Inc. (CAT), 0.5% in Chevron Corp. (CVX), and 20% each in Coca-Cola Co. (KO), International Business Machines (IBM), McDonald’s Corp. (MCD) and Wal-Mart Stores, Inc. (WMT). Holding these stocks in 2011 resulted in a return of 16.4%, as shown in Table 1. A graphical representation of the efficient frontier can be seen in Figure 3.

Source: Portfolio Optimization, David Herron. Data provided by AAII’s Stock Investor Pro/Thomson Reuters.

This process is continued in order to find the efficient portfolio for years 2006 through 2010. For example, the efficient portfolio for 2010 is calculated using the historical return, standard deviation and correlation data from 2006–2009, the efficient portfolio for 2009 is calculated using the data from 2005–2008, and so forth. Using this method, the returns for the companies making up the efficient portfolio for the past six years are shown in Table 1. Compared to the DJIA, the selections chosen using the Portfolio Optimization software resulted in higher returns and lower annual standard deviation. Furthermore, the results are based on an annual rebalance holding only five to six stocks, which is very little work for the individual investor.

In our second backtest, we used the program to attempt to “optimize” a holding of a mutual fund—the Vanguard Mid-Cap Index (VMCIX). The results are equally impressive. We used the data supplied by Morningstar.com to find a sample of the fund. Morningstar.com provides the top 25 holdings for mutual funds. Out of these holdings, we used the stocks that have price data going back to 2002 as a representation of the entire fund—a total of 16 stocks.

Source: Portfolio Optimization, David Herron. Data provided by AAII’s Stock Investor Pro/Thomson Reuters.

Figure 4 shows the 16 stocks used as a representation of VMCIX. As with the DJIA backtest, we used the Portfolio Optimization program to find the efficient portfolio for 2011 based on 2007–2010 returns, standard deviation and correlation. The efficient portfolio with the highest return was then used to calculate the return of the portfolio for 2011. The same methodology was used for each prior year (2006–2009 data was used to calculate the efficient portfolio for 2010, 2005–2008 data was used for 2009, etc.). The efficient portfolios for 2011 are shown in Figure 5 and the results of the backtest are shown in Table 1. As you can see, using the methodology, the returns generated holding the stocks selected by the Portfolio Optimization program are significantly higher than the fund’s return. In this case, the standard deviation of the portfolio is higher as well. Only five or six stocks are being held at one time, compared to 40+ for a mutual fund. Each year the efficient portfolio with the highest return was selected; therefore, it had the highest level of volatility. Selecting portfolios with lower return and volatility should alleviate the high standard deviation recorded by the portfolio.

Source: Portfolio Optimization, David Herron. Data provided by AAII’s Stock Investor Pro/Thomson Reuters.

To test this theory, we performed one final backtest using the Portfolio Optimization program, tweaking one small detail. Instead of using the efficient portfolio with the highest return, we used the efficient portfolio the second-highest return. When the data was scanned, there was a significant jump in volatility from the efficient portfolio with the second-highest return to the efficient portfolio with the highest return. The results are reported in Table 1.

Surprisingly, the average annual return generated by the second-highest selection is actually much higher than that of the highest-returning efficient portfolio. On top of that, the standard deviation is now lower than the VMCIX mutual fund.

How to Implement

Implementing MPT using the Portfolio Optimization program involves a few easy steps. When year-end data is available (usually a day or two after the last trading day of the year), select a portfolio of stocks for which you want to find the efficient frontier, whether it is a stock screen, mutual fund or an index. It is prudent to select this portfolio based on your personal risk-tolerance. If you are a conservative investor, it is probably not a good idea to select emerging markets or micro-cap mutual funds from which to build your portfolio. If you choose to use mutual funds, be sure to select ones that have performed well over the long run against other comparable funds.

After choosing a portfolio of stocks, create a sample file of the portfolio. The sample file should contain at least 20 representative stocks. For instance, if you select a mutual fund, use the top 20 or 25 holdings as a representative sample of the entire mutual fund. After preparing the efficient frontier of the sample file using the program, choose the efficient portfolio that is in line with your personal risk-preference and invest in those stocks in the given allocations.


Using the Portfolio Optimization program in the manner described is entirely quantitative. Investors make no “qualitative” judgment as to the health or future profitability for a specific company. In addition, creating a portfolio in this manner assumes transactions annually with very few stocks. There will be times of volatility and the annual portfolio rebalance may be too infrequent for some investors. On the plus side, transaction fees and commissions will be negligible for this portfolio.

Building portfolios using the Portfolio Optimization program was not tested in a “real-world” portfolio over time, but the results from these three specific backtests show that the strategy is promising. However, there are issues that need to be addressed. As we all know, company risk cannot be adequately diversified away by investing in five or six stocks and it is not recommended that you hold so few for an entire portfolio. In addition, the efficient frontier generated by the program uses past returns and correlations as a basis for choosing stocks going forward. Over the test period, it is easy to see that several stocks dominated the results. Choosing these high-performing stocks is difficult going forward and stocks that have performed well over the past several years may not perform well in future periods. Investment theory always looks good in theory. The difficulty lies in its implementation and whether the theory is predictive of future results.

One suggestion is to use this program and strategy for a portion of your investment holdings. Separately, investors can utilize this investment strategy with several portfolios. While it goes against MPT theory, using a separate “efficient portfolio” for each market sector or industry allows investors to build a well-diversified total market portfolio based on underlying fundamentals of modern portfolio theory.


H Bendet from NY posted over 6 years ago:

First, thank you David Herron for taking the time and effort to make "PO" available for AAII members each year.

I've been playing with and using "PO" since 2006 with decent success. However, I've always been concerned that each years' update is not available until February or March.

I noticed in the article that you suggest doing your analysis right after the new year. So my question is, Is there a way to do this with PO? Or, is there a workaround of some sort?

James Slack from TX posted over 5 years ago:

I receive an error as soon as I attempt to add a security (mutual fund or stock) to a new .SAM file. I know they are valid symbols because in some cases I have looked them up using PO. Has anyone else encountered this issue and if so is there a solution?

Gale Hamilton from VT posted over 5 years ago:

I am unable to run this program after downloading it onto my computer. I type run and the box that opens is a documents file that gives me direction to type PO which is a file I cannot find. I do find po12c.exe which brings me to the same document file with the same instructions. What am I doing wrong? I have tried it in IE and Chrome browsers. Results are the same.

David Volkman from NE posted over 5 years ago:

I am able to download the po12c.exe file but am having trouble running the install program. I get an error message stating that "The version of the this file is not compatible with ther versionof Windows You're running."

I am using Windows 7. Is there a program that will run on Windows 7?

J Sidinger from CO posted over 5 years ago:

Reply to David V.
Read last sentence of 3rd paragraph. I'm guessing you need to run in XP compatibility mode after downloading utility software from Microsoft.

GW Bush from SC posted over 5 years ago:

I've read everything and have been unable to run this yet! Ironically, I work in the IS/IT field. Yes it was changed to compat mode of XP.......but it does not work!

Michael Handy from OR posted over 5 years ago:

Can't download and run this program on my 64 bit computer which is frustrating. Why wouldn't the program be set to run on a 64 bit o/s? We are financial people not computer geeks going back and forth on different operating systems. I will be contacting AAII for help with this.

Joe Lan from IL posted over 5 years ago:

Michael, I understand your frustration but there is nothing we can do on our end. This is not our program and, of course, we have no control over what the creator of the program wants to do. I welcome you to contact me directly but I would only tell you what I'm saying here.

This feature was written because I found this program to be very useful. I hoped it would benefit anyone using a 32 bit system. As I stated in the article, those using a 64 bit system would have to use XP compatibility mode, as I did when testing the program.

R Stevens from TX posted over 5 years ago:

The program runs fine in native XP as well. Note this is a program that runs in a CMD (DOS) window, it does not use the Windows GUI as other programs do. Installation pretty much insists in being placed into the c:\po subdirectory. Running the po12c.exe executable found in the c:\po directory will unpack the remaining files, after which typing PO to execute the po.bat file will run the program.

You need to log in as a registered AAII user before commenting.
Create an account

Log In